Skip to content

Conversation

russss
Copy link
Contributor

@russss russss commented Apr 11, 2018

They were getting on my nerves.

@simonw
Copy link
Owner

simonw commented Apr 11, 2018

We should only do this if we're certain the spatialite module has been loaded. I could imagine someone having a sql_statements_log table of their own without using spatialite for example.

I think the most reliable way to detect spatialite is to run SELECT AddGeometryColumn(1, 2, 3, 4, 5); against a :memory: database and see if it throws an exception - similar to how we detect FTS. We could add this as a detect_spatialite() function in utils.py and call it once on startup.

@@ -1121,7 +1121,7 @@ def inspect(self):
tables[table]['foreign_keys'] = info

# Mark tables 'hidden' if they relate to FTS virtual tables
Copy link
Owner

Choose a reason for hiding this comment

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

Need to update this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd argue that still makes sense in context - not sure how to make it clearer!

@russss
Copy link
Contributor Author

russss commented Apr 11, 2018

I think the most reliable way to detect spatialite is to run SELECT AddGeometryColumn(1, 2, 3, 4, 5); against a :memory: database and see if it throws an exception

Or just see if there's a geometry_columns table? I think that's quite unlikely to be added by accident (and it's an OGC standard). It also tells you if Spatialite is installed in the database rather than just loaded.

They were getting on my nerves.
@russss russss force-pushed the hide-spatialite-tables branch from ab93635 to 765b5d6 Compare April 11, 2018 22:21
@simonw
Copy link
Owner

simonw commented Apr 12, 2018

Nice, thanks very much.

@simonw simonw merged commit d08a133 into simonw:master Apr 12, 2018
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.

2 participants