OOPDB
OOPDB - OOP wrapper for work with database. For now it's based on sqlite3 python lib.
Supported database features
-
Data types
- Integer (DataTypes.INTEGER) - simple type for storing integer numbers
- Text (DataTypes.TEXT) - simple type for storing text/strings with a maximum length of 65'535 bytes
-
Rows styling
- Dictionary - result on fetch will be list of dictionaries with keys equals to column names that was used in query
- Tuple - result on fetch will be list of tuples with value order equals to column names order that was used in query
-
Expression
- Equal - checks that value in table with given column name matches some given value
- Greater than - checks that value in table with given column name bigger than some given value
- Less than - checks that value in table with given column name less than some given value
- Greater than or equal - checks that value in table with given column name bigger than some given value or equal
- Less than or equal - checks that value in table with given column name less than some given value or equal
- Not equal - checks that value in table with given column name doesn't match some given value
- Like - checks that value in table with given column name matches some given pattern
- Between - checks that value in table with given column name matches some given interval
- In - checks that value in table with given column name consists in the given list of values
- Or - boolean operation that concatenates some other two expressions
- And - boolean operation that concatenates some other two expressions
- Not - negates some expression
-
Column configurations
-
Column config - base abstraction for describing column configuration using following information
- Name
- Nullability
- Type - type from DataTypes
-
Primary key - abstraction based on column config abstraction using following additional information
- Autoincrement
-
Foreign key - abstraction based on column config abstraction using following additional information
- Reference table name
- Reference column name
-
Column config - base abstraction for describing column configuration using following information
-
Commands
- Create table - creates table with the given name and list of column configurations
-
Select - select data from the given table and list of given column names in the table
- Distinct - optional configuration for select command to retrieve unique values
- Table names - get all table names that are exist in database
- Column names - get all column names that are exist in the table with the given table name
- Insert into - append row values to the table with the given name and list of column names
-
Select count - select row count from the table with the given name
- Distinct - optional configuration for select count command to retrieve count of the unique column values
- Inner join - merges two tables with the given table names and column names
- Order by - sort result by the given lists of column names and orders for each column
- Update - updates the table with the given name by the given lists of column names and new values for that columns
- Where - adds some condition based on Expression abstraction to the database queries
- Delete - deletes rows using conditions
- Last row id - returns the latest row's id that was inserted to the given table