-
Notifications
You must be signed in to change notification settings - Fork 3k
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(ingestion/oracle): Improved foreign key handling #11867
base: master
Are you sure you want to change the base?
Conversation
"\nac.constraint_name," | ||
"\nac.constraint_type," | ||
"\nacc.column_name AS local_column," | ||
"\nNULL AS remote_table," |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you set these to NULL?
Aren't these NULL anyway if we omit to select R
constraints? (if I guess right and R
means remote tables`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true, but this does end up being a little more efficient splitting this out into 2 UNION'ed queries on the Oracle side.
"\nON ac.owner = acc.owner" | ||
"\nAND ac.constraint_name = acc.constraint_name" | ||
"\nAND ac.table_name = acc.table_name" | ||
"\nWHERE ac.table_name = :table_name" | ||
"\nAND ac.constraint_type IN ('R','P', 'U', 'C')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't R
be omitted from this as it will be UNION
-ed anyway. This way it will generate duplicate rows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair point - I'll adjust
) | ||
|
||
text = text % {"dblink": dblink} | ||
if schema is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do schema
and owner come together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -552,8 +561,8 @@ def get_view_definition( | |||
text = "SELECT text FROM dba_views WHERE view_name=:view_name" | |||
|
|||
if schema is not None: | |||
text += " AND owner = :schema" | |||
params["schema"] = schema | |||
params["owner"] = schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is schema set as an owner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Oracle's DBA_VIEWS, the OWNER column represents the schema name that owns the view.
) # local_column | ||
pkeys.append(col_name) | ||
except Exception as e: | ||
logger.error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be using our structured reporting - see https://acryldata.notion.site/Error-reporting-in-ingestion-5343cc6ea0c84633b38070d1a409c569?pvs=4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a reporter hasn't been implemented at all in the Oracle connector I imagine that we should do that, right? There are a number of other areas that are currently logged but not reported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The oracle source uses our SQL common source internally, which does do this reporting in most places.
Overall, I'd like to opportunistically move towards structured logging whenever we make tweaks to connectors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reporter's errors/warnings have now been added.
Codecov ReportAttention: Patch coverage is
Continue to review full report in Codecov by Sentry.
|
Checklist