Skip to content

Instantly share code, notes, and snippets.

@pvilas
Last active July 5, 2023 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvilas/8fdb90a0755cf1e16a0bc23fb7363cb7 to your computer and use it in GitHub Desktop.
Save pvilas/8fdb90a0755cf1e16a0bc23fb7363cb7 to your computer and use it in GitHub Desktop.
Fer que sqlite3 pareixi concurrent
@receiver(connection_created)
def configure_sqlite(sender, connection, **kwargs):
    if connection.vendor == "sqlite":
        cursor = connection.cursor()
        cursor.execute("PRAGMA journal_mode = WAL;")
        cursor.execute("PRAGMA busy_timeout = 5000;")
        cursor.execute("PRAGMA synchronous = NORMAL;")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment