-
Notifications
You must be signed in to change notification settings - Fork 0
EasyTable
Notes:
You can check the source here
Arguments with[O]before the name are optional and not passing them will not cause any issues.
Arguments with[R]before the name are required and not passing them will cause python to raise an exception.
Arguments with[D <value>]before the name have default values that will be used if you do not pass them, But it is not guaranteed there will be no exceptions.
Arguments with[E <value>]before the name have default values but the value will cause an exception.
TheSTC-<Version>Methods/Properties are subjects to be changed or are depressed and might get removed in the specified version. If no version is specified it means there is no solid plan.
ThePUOMethods/Properties are for Private use only which you won't need to use yourself, They just exist for other classes to use.
To initialize the class you need to pass the following arguments:
- [R]
database: The EasyDatabase you have created - [R]
name: The name of the table - [R]
columns: The columns of the table which is a list of EasyColumns you have, It also accepts an empty list and will synchronize with the existing table. For more information check prepare method - [O]
auto_prepare: If the prepare method should be called automatically or not. It is recommended to have it set to true. If you pass None for columns it will be overridden by true
A method that will make sure you are using the right columns
A method that will match columns and values for data management commands
An advanced method that makes sure your table is ready to use.
If the table doesn't exist it will create one with columns defined. If the columns' argument is an empty list or None it will raise an exception.
If the table exists, it will get the existing columns, If the columns argument is an empty list or None, it will use the founded columns. If you have provided columns yourself, It will match the columns and raise an exception if they do not match.
A property of the class that will return the columns of this table, Found or given.
A property of the class that will return the name of the table.
Will try to find the column based on the value given.
If the value given is an EasyColumn itself, The exact one will be returned unless the column does not belong to the table.
If the value is a string, The column with the matching name will be returned.
If no match was found, None will be returned
This method will search and return data from table.
- [O]
columns: The columns that should be selected and returned to you. If you do not specify it all columns will be selected. - [O]
where: The Where Clause to be applied while searching in the data. If you do not specify it, all data will be selected.
If there was nothing found on the table, None will be returned.
If only one row was found, Data will be returned as a SelectData. This class has a data property that will return a dict and get that will return data related to that column.
If more than one row was matched, Data will be returned as a list of SelectDatas
This method will insert data into the table
- [R]
values: The data that is going to be inserted, can be a list (which will be matched one by one with the table columns) or a dictionary of columns to values.
This method will update data into the table
- [R]
values: The data that is going to be placed in the table, Same as insert values. - [O]
where: The Where Clause to be applied while updating. If you do not specify it, Probably theDatabaseSaftyExceptionwill be raised.
This method will use insert or update the data based on their existence.
- [R]
values: The data that is going to be placed in the table, Same as insert values. - [O]
where: The Where Clause to be applied while updating. If you do not specify it, Probably theDatabaseSaftyExceptionwill be raised.