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

Allow schema to be specified for target table in sqla.CopyToTable #2176

Merged
merged 1 commit into from
Aug 25, 2017

Conversation

sd2k
Copy link
Contributor

@sd2k sd2k commented Jul 10, 2017

Description

When using an RDBMS that supports schemas, this allows target tables to
exist in a non-default schema, specified using the 'schema' attribute of
the task class.

Motivation and Context

See #1984.

Have you tested this? If so, how?

I have been running my jobs with this code for several months and it has worked for me.
The unit tests use SQLite which doesn't support schemas, so I haven't included any unit tests.

)
if not row:
self.logger.info('Creating schema {}'.format(self.schema))
engine.execute(sqlalchemy.schema.CreateSchema(self.schema))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does a situation exist where you would intend for this to create a new schema? I can understand table creation in an existing schema, but cannot think of a case where I'd intentionally specify a schema name in my ETL for which one does not yet exist.

I worry that this may undesirably fail silently where someone has a typo in their schema name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it seems quite reasonable to ask users to create the schema separately to avoid this kind of silent failure. I'll remove that part and add a note.

When using an RDBMS that supports schemas, this allows target tables to
exist in a non-default schema, specified using the 'schema' attribute of
the task class.

Closes spotify#1984.
@Tarrasch Tarrasch merged commit bb6eccc into spotify:master Aug 25, 2017
@Tarrasch
Copy link
Contributor

Thanks @sd2k!

This was referenced Jun 29, 2022
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.

3 participants