Skip to content

Commit

Permalink
bq code added
Browse files Browse the repository at this point in the history
  • Loading branch information
ankit25587 committed Jul 2, 2022
1 parent d0718fa commit f73790f
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
EmpID,Name,Gender,Age
677509,Lois,F,36.36
940761,Brenda,F,47.02
428945,Joe,M,54.15
408351,Diane,F,39.67
193819,Benjamin,M,40.31
499687,Patrick,M,34.86
539712,Nancy,F,22.14
380086,Carol,F,59.12
477616,Frances,F,58.18
162402,Diana,F,29.73
231469,Ralph,M,42.5
153989,Jack,M,22.21
386158,Melissa,F,45.45
301576,Wayne,M,21.1
441771,Cheryl,F,59.47
528509,Paula,F,50.97
912990,Joshua,M,47.23
214352,Theresa,F,24.66
890290,Julia,F,58.08
622406,Thomas,M,49.85
979607,Carol,F,22.64
969580,Matthew,M,23.77
426038,Joan,F,44.72
388642,Ruby,F,37.27
560455,Carolyn,F,59.42
477253,Anne,F,28.02
263480,Daniel,M,27.59
683826,Roger,M,48.09
474599,Maria,F,42.39
335732,Brenda,F,53.68
329752,Lillian,F,36.24
893212,Amy,F,36.14
621833,Gregory,M,23.92
456747,Roy,M,26.24
278556,Richard,M,24.02
333476,Mary,F,49.69
218791,Aaron,M,48.49
134841,Donna,F,33.89
726264,Carl,M,43.63
766610,Joyce,F,55.97
923947,Mary,F,55.14
227922,Amanda,F,35.02
265813,Jack,M,32.58
247137,Alan,M,38.65
407061,Elizabeth,F,52.99
226714,Nancy,F,33.73
702813,Ernest,M,27.73
524896,Judy,F,56.38
363065,Nancy,F,23.73
879753,Pamela,F,21.3
958326,Larry,M,28.76
447813,Ann,F,28.23
525955,Judy,F,58.15
818384,Peter,M,34.75
971640,Clarence,M,56.66
253573,Sharon,F,26.25
904898,Ann,F,24.61
515103,Anne,F,59.27
491943,Nancy,F,56.27
750173,Antonio,M,21.93
687017,Frances,F,56.53
241882,Debra,F,47.78
758872,Henry,M,32.75
940922,Melissa,F,22.72
917937,Todd,M,25.93
917395,Christopher,M,57.37
183071,Andrea,F,32.08
316110,Jeremy,M,52.51
293459,Steven,M,30.9
732017,Cynthia,F,34.87
915638,Jason,M,43.59
478003,Cynthia,F,54.16
951225,Margaret,F,25.1
883936,Douglas,M,31.29
528673,Paul,M,58.43
765850,Linda,F,25.96
262382,Cheryl,F,32.29
870820,Martha,F,26.35
806955,William,M,50.05
325319,Carolyn,F,41.19
623253,Ruby,F,48.79
225925,Paul,M,25.98
761821,Ernest,M,32.77
400173,Dorothy,F,33.55
802554,Ryan,M,24.01
476433,Lillian,F,42.79
533952,Kelly,F,42.21
623929,Jimmy,M,50.7
844177,Margaret,F,35.91
212893,Janet,F,37.62
185032,Eugene,M,37.84
867084,Deborah,F,39.77
969964,Janice,F,37.57
158666,Rebecca,F,56
489424,Phillip,M,39.43
639892,Jose,M,22.82
704709,Harold,M,32.61
461593,Nicole,F,52.66
392491,Theresa,F,29.6
495141,Tammy,F,38.38
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name,company,joiningdate
Calvin Murphy,Quisque Ac Incorporated,2022-09-09
Plato Key,Duis Sit Amet PC,2022-09-09
Tashya Castillo,Aenean Egestas Inc.,2022-09-06
Cameron Harrell,Bibendum Fermentum Corporation,2022-09-09
Germaine Dominguez,Eu PC,2022-09-09
Cecilia Reilly,Magna Et Inc.,2022-09-09
Fritz Noble,Et Ultrices Corporation,2021-04-05
Summer Martinez,Mi Tempor Lorem Industries,2021-04-05
Chaim Bolton,Cras Pellentesque Sed PC,2021-04-05
Roary Atkinson,Augue Associates,2021-04-05
Marvin Davenport,Non Associates,2023-09-08
Maggie Blanchard,A Felis Inc.,2023-09-08
Ria Pugh,A Corp.,2023-09-08
Curran Roberson,Sociis Natoque LLP,2023-09-08
Richard Buckley,Eu Incorporated,2023-09-08
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from google.cloud import bigquery

client = bigquery.Client.from_service_account_json('keys.json')

dataset_id = "single-odyssey-349606.ds_from_python"

dataset = bigquery.Dataset(dataset_id)

dataset.location = "US"

dataset_ref = client.create_dataset(dataset, timeout=30)

print("Created dataset {}.{}".format(client.project, dataset_ref.dataset_id))
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from google.cloud import bigquery

client = bigquery.Client.from_service_account_json('keys.json')

table_id = "single-odyssey-349606.ds_from_python.emp_py"

job_config = bigquery.LoadJobConfig(
schema=[
bigquery.SchemaField("name", "STRING"),
bigquery.SchemaField("company", "STRING"),
bigquery.SchemaField("joiningdate", "DATE")
],
source_format=bigquery.SourceFormat.CSV, skip_leading_rows=1, autodetect=True,
)
file_path=r'employee.csv'
source_file = open(file_path, "rb")
job = client.load_table_from_file(source_file, table_id, job_config=job_config)

job.result() # Waits for the job to complete.

table = client.get_table(table_id) # Make an API request.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name,company,joiningdate
Calvin Murphy,Quisque Ac Incorporated,2022-09-09
Plato Key,Duis Sit Amet PC,2022-09-09
Tashya Castillo,Aenean Egestas Inc.,2022-09-06
Cameron Harrell,Bibendum Fermentum Corporation,2022-09-09
Germaine Dominguez,Eu PC,2022-09-09
Cecilia Reilly,Magna Et Inc.,2022-09-09
Fritz Noble,Et Ultrices Corporation,2021-04-05
Summer Martinez,Mi Tempor Lorem Industries,2021-04-05
Chaim Bolton,Cras Pellentesque Sed PC,2021-04-05
Roary Atkinson,Augue Associates,2021-04-05
Marvin Davenport,Non Associates,2023-09-08
Maggie Blanchard,A Felis Inc.,2023-09-08
Ria Pugh,A Corp.,2023-09-08
Curran Roberson,Sociis Natoque LLP,2023-09-08
Richard Buckley,Eu Incorporated,2023-09-08
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name,company,joiningdate
Stella Walker,Non LLC,9/8/2022
Jena Woodward,Semper Pretium LLC,8/19/2021
Jenna Maldonado,Metus Corp.,1/19/2022
Felicia Mercado,Etiam Bibendum Fermentum Industries,5/19/2023
Alden Berg,Semper Associates,12/9/2020
Brennan Kemp,Felis Adipiscing Industries,6/29/2021
Nasim Mathews,Cursus In Ltd,1/28/2021
Reagan Hall,Magna Foundation,4/13/2023
Leandra Berg,Pede Praesent LLC,10/26/2021
Delilah Coleman,Augue Eu Limited,12/26/2021
Moana Oliver,Pretium Aliquet Metus Associates,12/16/2022
Stella Klein,Luctus Incorporated,6/4/2023
Vance Moss,Vestibulum Limited,11/17/2021
Keely Carrillo,Vel Arcu Institute,1/5/2022
Vernon Rush,Amet Orci Ut Institute,4/18/2022
Malik Kim,Dolor Egestas Corporation,4/12/2023
Ali Sweet,Vivamus Ltd,1/2/2022
Carlos Britt,Sed Corporation,8/9/2022
Ralph Johnston,Quisque Imperdiet Consulting,5/5/2023
Sean Diaz,Consectetuer Mauris PC,3/19/2021

0 comments on commit f73790f

Please sign in to comment.