Data Source

Manage data sources.

See Connect Data to learn how data sources work in GoodData.

Entity Methods

Declarative Methods

Action Methods

Example

Since there are multiple data source types, here are examples, how to initialize each of them:

Postgres

CatalogDataSourcePostgres(
    id=data_source_id,
    name=data_source_name,
    db_specific_attributes=PostgresAttributes(
        host=os.environ["POSTGRES_HOST"],
        db_name=os.environ["POSTGRES_DBNAME"]
    ),
    schema=os.environ["POSTGRES_SCHEMA"],
    credentials=BasicCredentials(
        username=os.environ["POSTGRES_USER"],
        password=os.environ["POSTGRES_PASSWORD"],
    ),
)

Redshift

CatalogDataSourceRedshift(
    id=data_source_id,
    name=data_source_name,
    db_specific_attributes=RedshiftAttributes(
        host=os.environ["REDSHIFT_HOST"],
        db_name=os.environ["REDSHIFT_DBNAME"]
    ),
    schema=os.environ["REDSHIFT_SCHEMA"],
    credentials=BasicCredentials(
        username=os.environ["REDSHIFT_USER"],
        password=os.environ["REDSHIFT_PASSWORD"],
    ),
)

Snowflake

CatalogDataSourceSnowflake(
    id=data_source_id,
    name=data_source_name,
    db_specific_attributes=SnowflakeAttributes(
        account=os.environ["SNOWFLAKE_ACCOUNT"],
        warehouse=os.environ["SNOWFLAKE_WAREHOUSE"],
        db_name=os.environ["SNOWFLAKE_DBNAME"]
    ),
    schema=os.environ["SNOWFLAKE_SCHEMA"],
    credentials=BasicCredentials(
        username=os.environ["SNOWFLAKE_USER"],
        password=os.environ["SNOWFLAKE_PASSWORD"],
    ),
)

Vertica

CatalogDataSourceVertica(
    id=data_source_id,
    name=data_source_name,
    db_specific_attributes=VerticaAttributes(
        host=os.environ["VERTICA_HOST"],
        db_name=os.environ["VERTICA_DBNAME"]
    ),
    schema=os.environ["VERTICA_SCHEMA"],
    credentials=BasicCredentials(
        username=os.environ["VERTICA_USER"],
        password=os.environ["VERTICA_PASSWORD"],
    ),
)

BigQuery

CatalogDataSourceBigQuery(
    id=data_source_id,
    name=data_source_name,
    schema=os.environ["BIGQUERY_SCHEMA"],
    credentials=TokenCredentialsFromFile(
        file_path=Path(os.environ["BIGQUERY_CREDENTIALS"])
    ),
    parameters=[{"name": "projectId", "value": "abc"}],
)

Greenplum

CatalogDataSourceGreenplum(
    id=data_source_id,
    name=data_source_name,
    db_specific_attributes=GreenplumAttributes(
        host=os.environ["GREENPLUM_HOST"],
        db_name=os.environ["GREENPLUM_DBNAME"]
    ),
    schema=os.environ["GREENPLUM_SCHEMA"],
    credentials=BasicCredentials(
        username=os.environ["GREENPLUM_USER"],
        password=os.environ["GREENPLUM_PASSWORD"],
    ),
)