Skip to content

Commit

Permalink
fix(ingest): avoid sqlite "too many SQL variables" error (datahub-pro…
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Sep 10, 2024
1 parent c6eea1e commit 0d4eda6
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@

_DEFAULT_FILE_NAME = "sqlite.db"
_DEFAULT_TABLE_NAME = "data"
_DEFAULT_MEMORY_CACHE_MAX_SIZE = 2000
_DEFAULT_MEMORY_CACHE_EVICTION_BATCH_SIZE = 200

# As per https://stackoverflow.com/questions/7106016/too-many-sql-variables-error-in-django-with-sqlite3
# the default SQLITE_MAX_VARIABLE_NUMBER is 999. There's a few places where we embed one id from every
# item in the cache into a query (e.g. when implementing __len__), so we need to be careful not to
# exceed this limit.
_DEFAULT_MEMORY_CACHE_MAX_SIZE = 900
_DEFAULT_MEMORY_CACHE_EVICTION_BATCH_SIZE = 150

# https://docs.python.org/3/library/sqlite3.html#sqlite-and-python-types
# Datetimes get converted to strings
Expand Down

0 comments on commit 0d4eda6

Please sign in to comment.