Skip to content

Fix reading and writing data in different schema from public (Postgres)#47

Open
sdmj45 wants to merge 5 commits intomohaseeb:masterfrom
sdmj45:master
Open

Fix reading and writing data in different schema from public (Postgres)#47
sdmj45 wants to merge 5 commits intomohaseeb:masterfrom
sdmj45:master

Conversation

@sdmj45
Copy link

@sdmj45 sdmj45 commented Apr 14, 2022

This pull request is to fix the issues #27 #46 unable to read and write data in different schema from public(Postgres)

When calling relational_db.ReadFromDB() we can specify the schema which is 'public' by default.
Example:

source_config = relational_db.SourceConfiguration(
    drivername='postgresql',
    host='localhost',
    port=5432,
    username='postgres',
    password='postgres',
    database='postgres',
)
relational_db.ReadFromDB(
            source_config=source_config,
            table_name='table_name',
            schema='schema'
        )

And when writing to Postgres, we can also specify the schema in relational_db.TableConfiguration

 output_table_config = relational_db.TableConfiguration(
        name='test',
        schema='test_schema',
        create_if_missing=True,
        primary_key_columns=['id']
    )

relational_db.Write(
            source_config=source_config,
            table_config=output_table_config)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant