Db Sqlite¶
- class dffml.db.sqlite.SqliteDatabase(cfg)[source]¶
- CONFIG¶
alias of
SqliteDatabaseConfig
- CONTEXT¶
alias of
SqliteDatabaseContext
- class dffml.db.sqlite.SqliteDatabaseConfig(filename: str)[source]¶
- no_enforce_immutable()¶
By default, all properties of a config object are immutable. If you would like to mutate immutable properties, you must explicitly call this method using it as a context manager.
Examples
>>> from dffml import config >>> >>> @config ... class MyConfig: ... C: int >>> >>> config = MyConfig(C=2) >>> with config.no_enforce_immutable(): ... config.C = 1
- class dffml.db.sqlite.SqliteDatabaseContext(parent: BaseDatabase)[source]¶
- create_table(table_name: str, cols: Dict[str, str]) None [source]¶
Creates a table with name table_name if it doesn’t exist
- insert(table_name: str, data: Dict[str, Any]) None [source]¶
Inserts values to corresponding cols (according to position) to the table table_name
- lookup(table_name: str, cols: Optional[List[str]] = None, conditions: Optional[Union[List[List[Condition]], List[List[Tuple[str]]]]] = None) AsyncIterator[Dict[str, Any]] [source]¶
Returns list of rows (satisfying conditions if provided) from table_name