Skip to content
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

DM-13963: Enable foreign_key integrity checking on Butler SqlRegistry #28

Merged
merged 4 commits into from Apr 2, 2018

Conversation

pschella
Copy link
Collaborator

@pschella pschella commented Apr 2, 2018

No description provided.

Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall is fine. Can I please have some reasoning in the commit message that switches the datastore tests to a dummy registry rather than the in-memory registry?

@@ -21,7 +21,11 @@

import itertools

from sqlite3 import Connection as SQLite3Connection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we could have the sqlite knowledge in a subclass?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should. But I'm not sure we want to do that right now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be anything other than copying 20 lines to another file and changing the registry name in the yaml file?

def _enableForeignKeysOnSqlite3(dbapiConnection, connectionRecord):
if isinstance(dbapiConnection, SQLite3Connection):
cursor = dbapiConnection.cursor()
cursor.execute("PRAGMA foreign_keys=ON;")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need a try/finally here to ensure that cursor.close() is called? Or the internet gives the alternative form of:

from contextlib import closing
with closing(self.connection.cursor()) as cur:

Pim Schellart added 3 commits April 2, 2018 15:33
This is required because Registry.addStorageInfo enforces
its foreign-key relation with Registry.addDataset (which we
don't want to have to do in the Datastore only tests).
@pschella pschella merged commit 5cdf6c4 into master Apr 2, 2018
@ktlim ktlim deleted the tickets/DM-13963 branch August 25, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants