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

db.enable_counts() method #213

Closed
simonw opened this issue Jan 2, 2021 · 2 comments
Closed

db.enable_counts() method #213

simonw opened this issue Jan 2, 2021 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented Jan 2, 2021

Following #212 it would be useful if there was a utility method for enabling counts for ALL tables in a database:

db.enable_counts()

Open question: should this setup triggers for virtual tables such as FTS tables? Could that break things?

@simonw
Copy link
Owner Author

simonw commented Jan 2, 2021

I'm going to skip virtual tables, which I can identify using this property:

@property
def virtual_table_using(self):
"Returns type of virtual table or None if this is not a virtual table"
match = _virtual_table_using_re.match(self.schema)
if match is None:
return None
return match.groupdict()["using"].upper()

@simonw
Copy link
Owner Author

simonw commented Jan 2, 2021

I got this error while prototyping this:

too many levels of trigger recursion

It looks like that's because SQLite doesn't like triggers on a table that themselves then update that table - so I'm going to exclude the _counts table from this mechanism.

@simonw simonw closed this as completed in 9a5c92b Jan 2, 2021
simonw added a commit that referenced this issue Jan 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant