Exclude tempdb from the user -> login relationship query - #6
Open
quinten-elimity wants to merge 1 commit into
Open
quinten-elimity wants to merge 1 commit into
quinten-elimity wants to merge 1 commit into
Conversation
The user -> login query was the only query in the config that did not filter out tempdb (database_id 2). Every other entity and relationship query already carries `d.database_id <> 2`, so tempdb principals leaked into this one relationship, pointing at users that are never imported as entities, and the import failed. Also adds entity_types.json and relationships.json as a readable record of the queries that were run and verified against the customer's instance. Both are generated from config.hjson, so the queries are guaranteed to match the ones that ship.
quinten-elimity
force-pushed
the
exclude-tempdb-in-user-login-query
branch
from
September 15, 2026 08:32
fb7c635 to
53b7f62
Compare
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.
What changed
One line in
config.hjson— theuser->loginrelationship query was the only query in the config that did not filter outtempdb:Every other entity type and relationship query already carries
d.database_id <> 2. Because this one didn't, it emitted relationships pointing attempdbdatabase principals that are never imported asuserentities, and the import failed.Reference files
Two files added alongside the config, as a readable record of the queries that were run and verified against the customer's instance:
entity_types.json— all 9 entity type queries. Verified identical toconfig.hjson; no change was needed.relationships.json— all 12 relationship queries, including the fix above.Both are generated straight from
config.hjson, so the queries are guaranteed to match the ones that actually ship.Verification
Every query in both files was diffed against
config.hjsonone by one, plus the attribute lists per entity type. Thetempdbfilter is the only functional difference. The original export also carried stray newlines inside the column aliases[dbname_objectid],[name]and[DatabaseName]; regenerating from the config removed them.