DuckDB wrapper with iceberg writer
Project description
iceduck
DuckDB wrapper with iceberg writer
usage
duckdb
import iceduck as duckdb
with duckdb.connect() as con:
con.sql("CREATE TABLE test (i INTEGER)")
con.sql("INSERT INTO test VALUES (42)")
df = con.execute("select * from test").fetch_df()
print(df)
duckdb with Iceberg ( using local sqllite catalog )
Create a local folder
mkdir warehouse
import iceduck as duckdb
with duckdb.connect() as con:
con.sql("CREATE TABLE test (i INTEGER)")
con.sql("INSERT INTO test VALUES (42)")
warehouse_path = "./warehouse"
params = {
'type': 'sql',
"uri": f"sqlite:///{warehouse_path}/pyiceberg_catalog.db",
"warehouse": f"file://{warehouse_path}",
}
catalog = con.load_catalog(name='local', **params)
#create a namespace
if catalog._namespace_exists("default"):
print("Namespace already exists")
else:
print("Creating namespace")
catalog.create_namespace("default")
query_result = con.execute("select * from test")
result = query_result.upsert_iceberg('default.test_iceberg')
print(result)
Read iceberg table
import iceduck as duckdb
with duckdb.connect() as con:
warehouse_path = "./warehouse"
params = {
'type': 'sql',
"uri": f"sqlite:///{warehouse_path}/pyiceberg_catalog.db",
"warehouse": f"file://{warehouse_path}",
}
catalog = con.load_catalog(name='local', **params)
table = catalog.load_table("default.test_iceberg")
print(table.scan().to_arrow())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
iceduck-0.1.0.tar.gz
(9.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iceduck-0.1.0.tar.gz.
File metadata
- Download URL: iceduck-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52cd2a95af12abfa74bd120f368c5ab793f612f3e26b4e97ebf102ce76601ed7
|
|
| MD5 |
0007bd1d6b5b3e9dedd59eaa959343a4
|
|
| BLAKE2b-256 |
f6103d0a799044edab4170043922340f98528159e955fca5bd29852e9fe88f30
|
File details
Details for the file iceduck-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iceduck-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af2062f882b2e90555d614b0904823f12732e3f12a3214fc700cfe9c431be123
|
|
| MD5 |
5ca5dc29b1ea10033ab43dc5a105c3bd
|
|
| BLAKE2b-256 |
47cbc29e253ef03dd29713352bccc0dd7235197dce60bcb36145b8105c43a399
|