Skip to content

Add option to autocreate schema if not present? #198

Open
@laurentS

Description

@laurentS

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions