-
Notifications
You must be signed in to change notification settings - Fork 4
Enable the creation of external TableReferences #139
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
Conversation
Enabling external views for DuckDB depends on duckdb/duckdb#10322 |
We could implement a workaround since this problem is quite common among some SQLAlchemy backends. We have such a workaround in other places of the codebase. |
dict( | ||
name=tbl.name, | ||
schema=store.get_schema(tbl.stage.current_name).get(), | ||
schema=store.get_schema(tbl.stage.current_name, tbl).get(), |
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.
It is good to add external tables here. However, it might be worth noting which ones are external ones. We use this list to request a shared reader lock for DB2 on source tables. This list is not used to produce the actual query. Thus it might be ok to exclude external tables for some actions. An external table might also be a federated production table in DB2 which we should not lock or don't have the permission to lock.
=> This is important to keep in mind during roll-out for DB2
schema=store.get_schema(tbl.stage.current_name, tbl).get(), | |
schema=store.get_schema(tbl.stage.current_name, tbl).get(), | |
external_schema=tbl.external_schema, |
If we transport external_schema separately, we might not need to add tbl as argument to store.get_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.
I added a new argument db2_shared_lock_allowed
(still to be tested). Does that make sense?
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.
A DB2 test has been added in a5769bc
Done. |
# Conflicts: # docs/source/changelog.md
@windiana42 Let me know if it looks good now 😃 |
Also adjusted documentation to be more generic. Redefined default to False.
src_tables = [ | ||
f"{preparer.format_schema(tbl['schema'])}.{preparer.quote(tbl['name'])}" | ||
for tbl in create.source_tables | ||
if tbl["shared_lock_allowed"] |
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.
Just to remind myself: this is needed to prevent DB2 dialect from locking external table reference input tables if not allowed.
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.
Looks good to me (I changed a few things directly on the branch).
@nicolasmueller good catch! did you find something else? |
@windiana42 No, I am fine with merging then 👍 |
# Conflicts: # docs/source/changelog.md
Enable the creation of external TableReferences that reference tables in external schemas. This is useful to tell pipedag about tables that already exist in the database and should not be copied. It avoid manually reflecting them, which can sometimes be cumbersome as one might want to call a
Task
with a pipedagTable
and sometimes with an external table.Checklist
docs/source/changelog.md
entry