-
Notifications
You must be signed in to change notification settings - Fork 85
Skipping missing tables for leaf-collections #6397
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
Skipping missing tables for leaf-collections #6397
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
@@ -30,7 +30,7 @@ def format_clause_for_query( | |||
"""Returns field names in clauses surrounded by quotation marks as required by Snowflake syntax.""" | |||
return f'"{string_path}" {operator} (:{operand})' | |||
|
|||
def _generate_table_name(self) -> str: | |||
def generate_table_name(self) -> str: |
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.
Changing this from private to public
try: | ||
self.set_schema(connection) | ||
if ( | ||
query_config.partitioning | ||
): # only BigQuery supports partitioning, for now | ||
return self.partitioned_retrieval(query_config, connection, stmt) | ||
|
||
results = connection.execute(stmt) | ||
return self.cursor_result_to_rows(results) | ||
except Exception as exc: | ||
# Check if table exists using qualified table name | ||
if not self.table_exists(connection, node): | ||
# Central decision point - will raise TableNotFound or ConnectionException | ||
qualified_table_name = self.get_qualified_table_name(node) | ||
self.handle_table_not_found( | ||
node=node, | ||
table_name=qualified_table_name, | ||
operation_context="data retrieval", | ||
original_exception=exc, | ||
) | ||
# Table exists or can't check - re-raise original exception | ||
raise |
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.
Central handling for missing tables. Instead of checking for table existence before each query, we check after any exception. The other way to check for missing tables would be to parse various exceptions for missing tables but that seemed too fragile.
""" | ||
return node.collection.name | ||
|
||
def table_exists(self, connection: Connection, node: ExecutionNode) -> bool: |
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.
Generic way to check for table existence using SQLAlchemy. If this fails in any way we assume the table exists to maintain the current behavior.
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (36.36%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #6397 +/- ##
==========================================
- Coverage 87.14% 87.00% -0.14%
==========================================
Files 455 455
Lines 29179 29252 +73
Branches 3244 3256 +12
==========================================
+ Hits 25427 25451 +24
- Misses 3025 3069 +44
- Partials 727 732 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
👍 - code looks good but I only had a quick chance to look at it. I ran through your tests though and everything worked great
fides
|
Project |
fides
|
Branch Review |
main
|
Run status |
|
Run duration | 00m 53s |
Commit |
|
Committer | Adrian Galvan |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
5
|
Upgrade your plan to view test results. | |
View all changes introduced in this branch ↗︎ |
Closes ENG-1051
Description Of Changes
Added new behavior for
retrieve_data
requests with missing database tables.Code Changes
SQLConnector.retrieve_data
get_qualified_table_name
toSQLConnector
(overridden byBigQueryConnector
andSnowflakeConnector
)table_exists
toSQLConnector
Steps to Confirm
python qa bigquery_table_not_found setup
QA scenariocustomer-1@example.com
customer_profile_missing
collection is skippedpython qa bigquery_table_not_found setup --table customer
QA scenario (note thecustomer
param)customer-1@example.com
customer_missing
collection has downstream dependenciesPre-Merge Checklist
CHANGELOG.md
updatedmain
downgrade()
migration is correct and works