Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to autocreate schema if not present? #198

Open
laurentS opened this issue Feb 20, 2021 · 5 comments
Open

Add option to autocreate schema if not present? #198

laurentS opened this issue Feb 20, 2021 · 5 comments

Comments

@laurentS
Copy link
Collaborator

If I run target-postgres with postgres_schema set to a schema that does not exist at the start of the job, the code fails with the following error:

target_postgres.exceptions.PostgresError: ('Exception writing records', InvalidSchemaName('schema "tap_csv" does not exist\nLINE 1: CREATE TABLE "tap_csv"."mytable" ();\n                     ^\n'))

I can get around this by manually creating the schema, or possibly adding the schema creation to before_run_sql, but it feels a little cumbersome, especially if I have other SQL to run before execution.
Would it make sense to add a new boolean option like autocreate_schema to issue the schema creation command if it is not there? It could be False by default to maintain the current behaviour if needed.

@tayloramurphy
Copy link

I had a similar question for the Snowflake target. Andrew suggested it be included in the SQL base code in this project datamill-co/target-snowflake#22

@LazerJesus
Copy link

it feels like schemas should be created by target-postgres.
especially if its written explicitly in the config.

@andrewcstewart
Copy link

andrewcstewart commented Jul 12, 2021

Doesn't this target already autocreate schema? (Is this a stale issue? )

Nevermind! It's the meltano variant that supports schema autocreation. Always confusing :/

@mvgijssel
Copy link

Is this something the community could contribute to? As this is something we're running into as well.

@r-nyq
Copy link

r-nyq commented Oct 5, 2022

Is this issue dead? Would be great to have this feature

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

No branches or pull requests

6 participants