Last active
June 28, 2022 06:17
-
-
Save blackrez/900c772bdb620be7b655d52ca0fec138 to your computer and use it in GitHub Desktop.
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 | |
import connectorx as cx | |
con = duckdb.connect(database=':memory:') | |
sqlite_db = "sqlite://station.db" | |
query_sqlite = "SELECT * FROM stations" | |
arr = cx.read_sql(sqlite_db, query_sqlite, return_type='arrow') | |
r = con.execute('SELECT ville, count(1) FROM arr GROUP BY ville') | |
r.fetchall() | |
# [('Marseille', 63), ('Paris', 54), ('Toulouse', 34), ('Nice', 29), ('Limoges', 22), ('Montpellier', 20), ('Le Mans', 18), ('Reims', 18), ('Lyon', 17), ('Nantes', 17)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment