Is it possible to query Parquet files from SQLite?

Is it possible to use SQLite for querying over Parquet files?

CREATE TABLE test USING parquet('test.parquet'); SELECT * from test; 
0

2 Answers

Use Pandas to import the data first!

import pandas as pd import sqlite3 parquet_path = 'my-data.parquet' table_name = 'my_data_table' query = f"SELECT * from {table_name}" db_conn = sqlite3.connect(database='/tmp/my.db') df_parquet = pd.read_parquet(parquet_path) num_rows_inserted = df_parquet.to_sql(table_name, db_conn, index=False) cursor = db_conn.execute(query) 

If your requirement is to query both SQLite data and Parquet data using lightweight and embeddable tool, you can also consider DuckDB with SQLite scanner extension.

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like