Skip to content

LantaoJin/tpch-data

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

tpch-data

memory tables

$ pip install pyarrow duckdb
$ python3
>>> import duckdb
>>> import pyarrow.parquet as pq
>>> con = duckdb.connect(database=':memory:')
>>> con.execute("INSTALL tpch; LOAD tpch")
>>> con.execute("CALL dbgen(sf=10)")
>>> print(con.execute("show tables").fetchall())
>>> tables = ["customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"]
>>> for t in tables:
...     res = con.query("SELECT * FROM " + t)
...     pq.write_table(res.to_arrow_table(), t + ".parquet")
...

disk tables

$ pip install pyarrow duckdb
$ python3
>>> import duckdb
>>> import pyarrow.parquet as pq
>>> con = duckdb.connect(database='tpch.db')
>>> con.execute("INSTALL tpch; LOAD tpch")
>>> con.execute("CALL dbgen(sf=10)")
>>> print(con.execute("show tables").fetchall())
>>> tables = ["customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"]
>>> for t in tables:
...     print(f"Exporting {t}...")
...     con.execute(f"COPY {t} TO '{t}.parquet' (FORMAT PARQUET)")
...     print(f"  done")
...

About

Generate tpch data in parquet format

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors