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

fix(luigi/contrib/postgres.py): replace copy_from with copy_expert #3324

Merged
merged 2 commits into from
Nov 30, 2024

Conversation

delhomer
Copy link
Contributor

@delhomer delhomer commented Nov 28, 2024

Description

copy_from does not accept 'schema.table' notation since psycopg2.9. Then a bug arises in Luigi if the table refers a schema name.

This PR modifies the copy method behavior, by refering copy_expert instead of copy_from, as suggested in psycopg/psycopg2#1294.

Motivation and Context

I'm trying to insert some data into a table that is stored into a specific schema (which is not the public schema), and remain stucked at this stage. See #3198 for details.

Have you tested this? If so, how?

Design the following task class and run luigi --local-scheduler --module fulltablename InsertIntoDB :

# fulltablename.py
class InsertIntoDB(CopyToTable):

    table = "dummy_schema.dummy_table"
    ... # other mandatory CopyToTable attributes

Fix #3198

copy_from does not accept 'schema.table' notation since
psycopg2.9. Then a bug arises in Luigi if the table refers a schema
name.

This PR modifies the 'copy' method behavior, by refering copy_expert
instead of copy_from, as suggested in
psycopg/psycopg2#1294.

Fix spotify#3198
@delhomer delhomer requested review from dlstadther and a team as code owners November 28, 2024 13:42
@dlstadther dlstadther merged commit e71265b into spotify:master Nov 30, 2024
48 checks passed
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.

[contrib.postgres] copy_from does not accept schema.table notation in most recent psycopg2 versions
2 participants