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.
If I run
target-postgreswithpostgres_schemaset to a schema that does not exist at the start of the job, the code fails with the following error: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_schemato issue the schema creation command if it is not there? It could beFalseby default to maintain the current behaviour if needed.