Google BigQuery¶
Install¶
Install ibis and dependencies for the Google BigQuery backend:
pip install 'ibis-framework[bigquery]'
conda install -c conda-forge ibis-bigquery
mamba install -c conda-forge ibis-bigquery
Connect¶
API¶
Create a client by passing in connection parameters to ibis.bigquery.connect
.
See ibis.backends.bigquery.Backend.do_connect
for connection parameter information.
ibis.bigquery.connect
is a thin wrapper around ibis.backends.bigquery.Backend.do_connect
.
Connection Parameters¶
do_connect(project_id=None, dataset_id='', credentials=None, application_name=None, auth_local_webserver=True, auth_external_data=False, auth_cache='default', partition_column='PARTITIONTIME')
¶
Create a :class:Backend
for use with Ibis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id |
str | None
|
A BigQuery project id. |
None
|
dataset_id |
str
|
A dataset id that lives inside of the project indicated by
|
''
|
credentials |
google.auth.credentials.Credentials | None
|
Optional credentials. |
None
|
application_name |
str | None
|
A string identifying your application to Google API endpoints. |
None
|
auth_local_webserver |
bool
|
Use a local webserver for the user authentication. Binds a webserver to an open port on localhost between 8080 and 8089, inclusive, to receive authentication token. If not set, defaults to False, which requests a token via the console. |
True
|
auth_external_data |
bool
|
Authenticate using additional scopes required to |
False
|
auth_cache |
str
|
Selects the behavior of the credentials cache.
Defaults to |
'default'
|
partition_column |
str | None
|
Identifier to use instead of default |
'PARTITIONTIME'
|
Returns:
Type | Description |
---|---|
Backend
|
An instance of the BigQuery backend. |
Backend API¶
Backend
¶
Bases: BaseSQLBackend
Functions¶
execute(expr, params=None, limit='default', **kwargs)
¶
Compile and execute the given Ibis expression.
Compile and execute Ibis expression using this backend client interface, returning results in-memory in the appropriate object type
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expr |
Ibis expression to execute |
required | |
limit |
Retrieve at most this number of values/rows. Overrides any limit already set on the expression. |
'default'
|
|
params |
Query parameters |
None
|
|
kwargs |
Extra arguments specific to the backend |
{}
|
Returns:
Type | Description |
---|---|
pd.DataFrame | pd.Series | scalar
|
Output from execution |
exists_database(name)
¶
Return whether a database name exists in the current connection.
Deprecated in Ibis 2.0. Use name in client.list_databases()
instead.
exists_table(name, database=None)
¶
Return whether a table name exists in the database.
Deprecated in Ibis 2.0. Use name in client.list_tables()
instead.