Connections

Attention

Hashquery is currently in public preview. Here are some caveats to keep in mind for early adopters:

  • Backwards compatibility may not be preserved between version upgrades, and you may need to update your package regularly.

  • There may be differences in the SQL logic generated by hashquery compared to the Hashboard app.

  • You may encounter dialect-specific SQL syntax errors or other unexpected errors. If you come across one, let us know by reporting an issue.

class Connection
classmethod duckdb(**contents: LocalDataFrameRef) DuckDBConnection

Initialize a new DuckDB connection with the provided contents. Takes in a mapping of names to content data frames, which will each be loaded into a DuckDB instance as table with that name.

Content can be specified as a path to a .csv, .json, or .parquet file, a pandas DataFrame, or a list of Python records.

classmethod bigquery(
*,
credentials_path: str | None = None,
credentials_info: dict | None = None,
) BigQueryConnection

Initialize a new BigQuery connection.

By default, the connection will be authenticated using the environment variable GOOGLE_APPLICATION_CREDENTIALS, according to the same logic as the BigQuery client library. https://cloud.google.com/docs/authentication/application-default-credentials

Alternatively, you can specify an explicit path to a service account JSON file using credentials_path, or use a python dictionary using credentials_info. https://github.com/googleapis/python-bigquery-sqlalchemy?tab=readme-ov-file#authentication


Connections store secrets in a special wrapped Secret value and are never serialized or sent across network boundaries.