SQLiteEngine is very simple - just specify a file path. The database
file will be created automatically if it doesn’t exist.
# piccolo_conf.py from piccolo.engine.sqlite import SQLiteEngine DB = SQLiteEngine(path='my_app.sqlite')
- class piccolo.engine.sqlite.SQLiteEngine(path: str = 'piccolo.sqlite', log_queries: bool = False, log_responses: bool = False, **connection_kwargs)¶
path – A relative or absolute path to the the SQLite database file (it will be created if it doesn’t already exist).
log_queries – If
True, all SQL and DDL statements are printed out before being run. Useful for debugging.
log_responses – If
True, the raw response from each query is printed out. Useful for debugging.
connection_kwargs – These are passed directly to the database adapter. We recommend setting
timeoutif you expect your application to process a large number of concurrent writes, to prevent queries timing out. See Python’s sqlite3 docs for more info.
If you’re planning on using SQLite in production with Piccolo, with lots of concurrent queries, then here are some useful tips.