Fix: Use fully qualified table names for DLSync metadata tables#57
Merged
sfc-gh-yhailu merged 2 commits intoSnowflake-Labs:mainfrom Feb 5, 2026
Merged
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
sfc-gh-yhailu
requested changes
Feb 4, 2026
Collaborator
sfc-gh-yhailu
left a comment
There was a problem hiding this comment.
Hi @NemSimpraga this is great. I have added some comments. Instead of creating and using the getFullyQualified for each table, Can we use the method getFullyQualifiedTableName() instead ?
To help for the release automation, And can you also update the following:
- update the version in
gradle.propertiesfile toreleaseVersion=3.0.1 - add your change log to
CHANGELOG.mdfile.
other than that it looks good to me.
- Remove redundant wrapper methods, use getFullyQualifiedTableName() directly - Update version to 3.0.1 in gradle.properties - Add changelog entry for the fix
e9f1bbb to
2effb7f
Compare
sfc-gh-yhailu
approved these changes
Feb 5, 2026
Collaborator
sfc-gh-yhailu
left a comment
There was a problem hiding this comment.
Looks good to me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When DLSync manages account-level objects (databases or schemas), it breaks with errors like:
Table 'DL_SYNC_SCRIPT_HISTORY' does not exist or not authorizedDL_SYNC_SCRIPT_EVENTandDL_SYNC_CHANGE_SYNCtablesRoot Cause
When Snowflake executes
CREATE DATABASEorCREATE SCHEMAcommands, it automatically changes the session context to the newly created database/schema. Since DLSync uses non-fully-qualified table names for its metadata tables, subsequent queries fail because they look for the tables in the new context instead of the original DLSync schema.Solution
This PR updates all references to DLSync metadata tables to use fully qualified names in the format
database.schema.table_name.Changes Made
Added helper methods to generate fully qualified table names:
getFullyQualifiedTableName(String tableName)getFullyQualifiedChangeSyncTable()getFullyQualifiedScriptHistoryTable()getFullyQualifiedScriptEventTable()getFullyQualifiedDependencyLineageTable()Updated all SQL queries in
ScriptRepo.javato use these helper methods, ensuring all references to metadata tables are fully qualified regardless of the current session context.Testing
Tested with a custom Docker image deploying account-level objects (databases and schemas). The fix successfully prevents the session context issue and DLSync operations complete without errors.
Impact
This fix ensures DLSync can manage account-level objects without breaking, making it fully compatible with all object types it claims to support.
Fixes the issue reported in the repository discussions.
References #56