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

rdbms contrib: pass connection to _add_metadata_columns #3011

Merged
merged 3 commits into from
Jan 11, 2022

Conversation

Styren
Copy link
Contributor

@Styren Styren commented Oct 26, 2020

Description

The method _MetadataColumnsMixin#_add_metadata_columns accepts a connection parameter for creating the metadata columns for the CopyToTable task. However, the general CopyToTable instead sends a cursor while the redshift version sends the correct connection:

if self.enable_metadata_columns:
self._add_metadata_columns(connection)

Motivation and Context

Without this change you run into a AttributeError when you select enable_metadata_columns = True, when for example using the postgres CopyToTable.

  File "/usr/local/lib/python3.8/site-packages/luigi/contrib/rdbms.py", line 252, in init_copy
    self._add_metadata_columns(connection.cursor())
  File "/usr/local/lib/python3.8/site-packages/luigi/contrib/rdbms.py", line 103, in _add_metadata_columns
    cursor = connection.cursor()
AttributeError: 'psycopg2.extensions.cursor' object has no attribute 'cursor'

Have you tested this? If so, how?

Ran the contrib tests.

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If closed, you may revisit when your time allows and reopen! Thank you for your contributions.

@stale stale bot added the wontfix label Jan 9, 2022
@dlstadther dlstadther requested a review from a team as a code owner January 11, 2022 02:07
@stale stale bot removed the wontfix label Jan 11, 2022
@dlstadther
Copy link
Collaborator

Apologies for massive delay. Stalebot comments on a bunch of Luigi PRs and that reminded me that I approved some PRs and never merged them. Going back through them now, updating them with master, and confirming that all their checks pass.

@dlstadther dlstadther merged commit 800f53f into spotify:master Jan 11, 2022
@Styren Styren deleted the call-add-metadata-w-cursor branch May 3, 2023 08:45
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.

2 participants