-
-
Save kevpie/b55589ab3737264f604f8f6b1cb29be2 to your computer and use it in GitHub Desktop.
Read BQ table to DuckDB directly from storage read api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import duckdb | |
from google.cloud import bigquery | |
bqclient = bigquery.Client() | |
table = bigquery.TableReference.from_string( | |
"bigquery-public-data.utility_us.country_code_iso" | |
) | |
rows = bqclient.list_rows(table) | |
country_code_iso = rows.to_arrow(create_bqstorage_client=True) | |
cursor = duckdb.connect() | |
print(cursor.execute('SELECT * FROM country_code_iso').fetchall()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment