Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

TargetConfigs' credentials gets dropped upon loading a DbtCliProfile #114

Closed
ahuang11 opened this issue Jan 11, 2023 · 0 comments · Fixed by #115
Closed

TargetConfigs' credentials gets dropped upon loading a DbtCliProfile #114

ahuang11 opened this issue Jan 11, 2023 · 0 comments · Fixed by #115

Comments

@ahuang11
Copy link
Contributor

ahuang11 commented Jan 11, 2023

from prefect import flow
from prefect_gcp import GcpCredentials
from prefect_dbt.cli import BigQueryTargetConfigs, DbtCliProfile

ENV = "abc"

@flow
def test_flow():
    credentials = GcpCredentials.load('gcp-credentials')
    bq_target_dict = {
        'schema': f'zone_hawk_{ENV}',
        'project': 'my_gcp_project',
        'threads': 20,
        'credentials': credentials
    }

    bq_target_configs = BigQueryTargetConfigs(**bq_target_dict)
    bq_target_configs.save(f'bq-target-configs-{ENV}', overwrite=True)

    target_configs = BigQueryTargetConfigs.load(f'bq-target-configs-{ENV}')
    dbt_cli_dict = {
        'name': 'bigbird',
        'target': f'{ENV}',
        'target_configs': target_configs
    }
    dbt_cli_profile = DbtCliProfile(**dbt_cli_dict)
    dbt_cli_profile.save(f'dbt-cli-profile-{ENV}', overwrite=True)
    print(dbt_cli_profile)

    dbt_cli_profile2 = DbtCliProfile.load(f"dbt-cli-profile-{ENV}")
    return dbt_cli_profile2

test_flow()

Returns:


DbtCliProfile(name='bigbird', target='abc', target_configs=TargetConfigs(extras=None, type='bigquery', threads=20), global_configs=None)

Expected:


DbtCliProfile(name='bigbird', target='abc', target_configs=BigQueryTargetConfigs(extras=None, type='bigquery', threads=20, project='my_gcp_project', credentials=GcpCredentials(service_account_file=None, service_account_info=SecretDict('{'type': '**********', 'auth_uri': '**********', 'client_id': '**********', 'token_uri': '**********', 'project_id': '**********', 'private_key': '**********', 'client_email': '**********', 'private_key_id': '**********', 'client_x509_cert_url': '**********', 'auth_provider_x509_cert_url': '**********'}'), project='myproject')), global_configs=None)
@ahuang11 ahuang11 changed the title TargetConfigs gets dropped upon loading a DbtCliProfile TargetConfigs' credentials gets dropped upon loading a DbtCliProfile Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant