Posts

Commands to connect to Big query -python from google.cloud import bigquery #create client object client=bigquery.client() #create reference dataset_ref=client.dataset(“hacker_news”,project=”bigquery-public-data”) #api request to fetch the dataset dataset=client.get_dataset(dataset_ref) #list all tables using list_tables() function tables=list(client.list_tables(dataset)) For tables in tables:                Print(table.table_id) #create reference to full table table_ref=dataset_ref.table(“full”) #api request to fetch table Table=client.get_table(table_ref) Table.schema output :- name, field type, mode(nullable), description #preview first five rows of the “full” table client.list_rows(table,max_result=5).to_dataframe() # Preview the first five entries in the "by" column of the "full" table client.list_rows(table, selected_fields=table.schema[:1], max_re...
Recent posts