data_algebra/BigQuery.py
def example_handle():
    """
    Return an example db handle for testing. Returns None if helper packages not present.
    Note: binds in a data_catalog and data schema prefix. So this handle is specific
    to one database.

    """
    # TODO: parameterize this
    assert _have_bigquery
    credential_file = "/Users/johnmount/big_query/big_query_jm.json"
    # assert os.path.isfile(credential_file)
    os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = credential_file
    # os.environ["GOOGLE_APPLICATION_CREDENTIALS"]  # trigger key error if not present
    try:
        data_catalog = "data-algebra-test"
        data_schema = "test_1"
        db_handle = BigQueryModel(
            table_prefix=f"{data_catalog}.{data_schema}"
        ).db_handle(google.cloud.bigquery.Client())
        db_handle.db_model.prepare_connection(db_handle.conn)
        return db_handle
    except Exception as e:
        return None

    Return an example db handle for testing. Returns None if helper packages not present.
    Note: binds in a data_catalog and data schema prefix. So this handle is specific
    to one database.

    
Return an example db handle for testing. Returns None if helper packages not present.
Note: binds in a data_catalog and data schema prefix. So this handle is specific
to one database.
Return an example db handle for testing . Returns None if helper packages not present . Note : binds in a data_catalog and data schema prefix . So this handle is specific to one database .
def example_handle():
    assert _have_bigquery
    credential_file = "/Users/johnmount/big_query/big_query_jm.json"
    os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = credential_file
    try:
        data_catalog = "data-algebra-test"
        data_schema = "test_1"
        db_handle = BigQueryModel(
            table_prefix=f"{data_catalog}.{data_schema}"
        ).db_handle(google.cloud.bigquery.Client())
        db_handle.db_model.prepare_connection(db_handle.conn)
        return db_handle
    except Exception as e:
        return None
def example_handle ( ) : assert _have_bigquery credential_file = "/Users/johnmount/big_query/big_query_jm.json" os . environ [ "GOOGLE_APPLICATION_CREDENTIALS" ] = credential_file try : data_catalog = "data-algebra-test" data_schema = "test_1" db_handle = BigQueryModel ( table_prefix = f"{data_catalog}.{data_schema}" ) . db_handle ( google . cloud . bigquery . Client ( ) ) db_handle . db_model . prepare_connection ( db_handle . conn ) return db_handle except Exception as e : return None
Return an example db handle for testing.
Return an example db handle for testing .
"""
    Return an example db handle for testing. Returns None if helper packages not present.
    Note: binds in a data_catalog and data schema prefix. So this handle is specific
    to one database.

    """ # TODO: parameterize this # assert os.path.isfile(credential_file) # os.environ["GOOGLE_APPLICATION_CREDENTIALS"]  # trigger key error if not present