Class used for indexing a base on a field. The instance of Index is an attribute of the Base instance
protocol as defined in pickle / pickle. Defaults to the highest protocol available. For maximum compatibility use protocol = 0
protocol as defined in pickle / pickle. Defaults to the highest protocol available. For maximum compatibility use protocol = 0
Create a new base with specified field names.
Create an index on the specified field names
An index on a field is a mapping between the values taken by the field and the sorted list of the ids of the records whose field is equal to this value
For each indexed field, an attribute of self is created, an instance of the class Index (see above). Its name it the field name, with the prefix _ to avoid name conflicts
Remove a single record, or the records in an iterable
Before starting deletion, test if all records are in the base and don’t have twice the same __id__
The list of the fields (does not include the internal fields __id__ and __version__)
Insert one or more records in the database.
Parameters can be positional or keyword arguments. If positional they must be in the same order as in the create() method If some of the fields are missing the value is set to None
The basename of the path, stripped of its extension
The path of the database in the file system
Main differences from pydblite.pydblite:
To create an in-memory database provide ‘:memory:’ as filename
The SQLite connection
The SQLite connections cursor
Args:
Selection by field values.
db(key=value) returns the list of records where r[key] = value
Args:
- table_name (str): The name of the SQLite table.
- db (Database): The database.
Add a new column to the table.
When a record is returned by a SELECT, ask conversion of specified field value with the specified function.
Create a new table.
fields (list of tuples): The fields names/types to create. For each field, a 2-element tuple must be provided:
mode is only used if a database file already exists.
The SQLite connections cursor
Remove a single record, or the records in an iterable.
Before starting deletion, test if all records are in the base and don’t have twice the same __id__.
A filter to be used to filter the results from a database query. Users should not have to use this class.
Returns a new filter that combines this filter with other_filter using AND.
Perform EQUALS operation When input value is an iterable, but not a string, it will match for any of the values on the iterable