Skip to content

Instantly share code, notes, and snippets.

@ML-engineer
Created July 4, 2022 22:08
Show Gist options
  • Select an option

  • Save ML-engineer/e28ae87e830ca7f8e594bce6ca33e38c to your computer and use it in GitHub Desktop.

Select an option

Save ML-engineer/e28ae87e830ca7f8e594bce6ca33e38c to your computer and use it in GitHub Desktop.

Revisions

  1. ML-engineer created this gist Jul 4, 2022.
    11 changes: 11 additions & 0 deletions duckdb_bq_storage_api.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    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())