ordeq_bigquery
BigQueryJSON
dataclass
¶
Bases: IO[list[dict[str, Any]]]
IO for loading data using a user provided query and saving data from JSON-compatible data representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_id
|
str | Table
|
BigQuery table identifier |
required |
client
|
Client
|
BigQuery client |
required |
query
|
str | None
|
SQL query to load data, e.g. |
None
|
load(**query_options)
¶
Loads query results from BigQuery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**query_options
|
Any
|
Additional options for the query. |
{}
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of rows as dictionaries. Raises typeerror with query is not |
list[dict[str, Any]]
|
provided. |
Raises:
| Type | Description |
|---|---|
TypeError
|
if query is not provided, i.e. is None |
Example:
1 2 3 4 5 6 7 8 9 10 | |
save(data, **save_options)
¶
Saves JSON rows to BigQuery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
list[dict[str, Any]]
|
Dictionary or list of dictionaries to insert. |
required |
**save_options
|
Any
|
Additional options for saving. |
{}
|
Raises:
| Type | Description |
|---|---|
IOException
|
If insertion fails. |
Example:
1 2 3 4 5 6 7 8 9 10 11 | |
BigQueryPandas
dataclass
¶
Bases: IO[DataFrame]
BigQueryTable extension for loading and saving Pandas DataFrames.
Example:
1 2 3 4 5 6 7 8 9 | |
load(**load_options)
¶
Loads the BigQuery table as a Pandas DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**load_options
|
Any
|
Additional options passed to |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A Pandas DataFrame containing the table data. |
Example:
1 2 3 4 5 6 7 8 | |
save(df, **save_options)
¶
Saves a Pandas DataFrame to the BigQuery table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
The Pandas DataFrame to save. |
required |
**save_options
|
Any
|
Options passed to |
{}
|
Example:
1 2 3 4 5 6 7 8 9 10 | |