ordeq_duckdb
DuckDBCSV
dataclass
¶
Bases: IO[DuckDBPyRelation]
IO to load and save CSV files using DuckDB.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
load(**kwargs)
¶
Load a CSV file into a DuckDB relation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Additional options to pass to duckdb.read_csv. |
{}
|
Returns:
| Type | Description |
|---|---|
DuckDBPyRelation
|
The DuckDB relation representing the loaded CSV data. |
save(relation, **kwargs)
¶
Save a DuckDB relation to a CSV file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relation
|
DuckDBPyRelation
|
The relation to save. |
required |
**kwargs
|
Any
|
Additional options to pass to |
{}
|
DuckDBConnection
dataclass
¶
DuckDBParquet
dataclass
¶
Bases: IO[DuckDBPyRelation]
IO to load and save Parquet files using DuckDB.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
load(**kwargs)
¶
Load a Parquet file into a DuckDB relation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Additional options to pass to duckdb.read_parquet. |
{}
|
Returns:
| Type | Description |
|---|---|
DuckDBPyRelation
|
The DuckDB relation representing the loaded Parquet data. |
save(relation, **kwargs)
¶
Save a DuckDB relation to a Parquet file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relation
|
DuckDBPyRelation
|
The relation to save. |
required |
**kwargs
|
Any
|
Additional options to pass to |
{}
|
DuckDBTable
dataclass
¶
Bases: IO[DuckDBPyRelation]
IO to load from and save to a DuckDB table.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
Example in a node:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
load()
¶
Load the DuckDB table into a DuckDB relation.
Returns:
| Type | Description |
|---|---|
DuckDBPyRelation
|
A relation representing the loaded table. |
save(relation, mode='create')
¶
Save a relation to the DuckDB table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relation
|
DuckDBPyRelation
|
The relation to save. |
required |
mode
|
Literal['create', 'insert']
|
The save mode. "create" will create the table, "insert" will insert into the table if it exists, or create it if it doesn't. |
'create'
|
Raises:
| Type | Description |
|---|---|
CatalogException
|
If the table already exists and mode is "create". |
DuckDBView
dataclass
¶
Bases: IO[DuckDBPyRelation]
IO to load and save a DuckDB view.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
By default, the view will be replaced if it already exists.
To change this, pass replace=False to the save method:
1 2 3 | |
Example in a node:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
load()
¶
Loads a DuckDB view.
Returns:
| Type | Description |
|---|---|
DuckDBPyRelation
|
The DuckDB view. |
save(relation, replace=True)
¶
Saves a DuckDB relation to a DuckDB view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relation
|
DuckDBPyRelation
|
The DuckDB relation to save. |
required |
replace
|
bool
|
Whether to replace the view if it already exists. |
True
|