operations
Create an empty sqlite database.
get_demo_db()
Return an initialized SQLiteDB object with default settings.
Returns
(SQLiteDB): An initialized `SQLiteDB` instance. A SQLite database file will also be created at the path: `.db/demo.db`
Raises
Exception: When SQLite database initialization is unsuccessful
Source code in src/red_utils/std/sqlite_utils/operations.py
get_sqlite_db(name=None, location=None)
Initialize a SQLiteDB object.
This is the same as simply instantiating a SQLiteDB object, like:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
The name of the SQLite database. This will be used for the filename. |
None
|
location |
str | Path
|
The directory location to save the database. Note that Path values will be converted to string, then |
None
|
Returns
(SQLiteDB): An initialized `SQLiteDB` object
Raises
ValueError: When input value validation fails
Exception: When SQLite database initialization fails
Source code in src/red_utils/std/sqlite_utils/operations.py
init_sqlite_db(db_definition=None)
Initialize an empty SQLite database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_definition |
SQLiteDB
|
An initialized SQLiteDB object defining the SQLite database to create. |
None
|
Returns
(bool): `True` if SQLite database successfully initialized
(bool): `False` if SQLite database initialization unsuccessful
Raises
Exception: When initializing empty SQLite database fails