IMP
2.2.0
The Integrative Modeling Platform
|
Class to manage a SQL database built with sqlite3. More...
Public Member Functions | |
def | add_column |
Add a column to a table column - the name of the column. More... | |
def | add_columns |
Add columns to the database. More... | |
def | check_if_is_connected |
Checks if the class is connected to the database filename. | |
def | close |
Closes the database. | |
def | connect |
Connects to the database in filename. | |
def | create |
Creates a database by simply connecting to the file. | |
def | create_table |
Creates a table. More... | |
def | create_view |
creates a view of the given table where the values are selected using the condition values. More... | |
def | drop_table |
Delete a table if it exists. | |
def | drop_view |
Removes a view from the database. | |
def | get_condition_string |
creates a condition applying each value to each field | |
def | get_table |
Returns th fields requested from the table. | |
def | get_table_column_names |
Get the names of the columns for a given table. | |
def | get_table_types |
Gets info about a table and retuns all the types in it. | |
def | retrieve_data |
Retrieves data from the database using the sql_command returns the records as a list of tuples. | |
def | select_table |
Prompt for tables so the user can choose one. | |
def | store_data |
Inserts information in a given table of the database. More... | |
def | store_dataV1 |
Inserts information in a given table of the database. More... | |
def | update_data |
updates the register in the table identified by the condition values for the condition fields | |
Definition at line 13 of file Database.py.
def IMP.em2d.Database.Database2.add_column | ( | self, | |
table, | |||
column, | |||
data_type | |||
) |
data_type - the type: int, float, str
Definition at line 244 of file Database.py.
def IMP.em2d.Database.Database2.add_columns | ( | self, | |
table, | |||
names, | |||
types, | |||
check = True |
|||
) |
If check=True, columns with names already in the database are skipped. If check=False no check is done and trying to add a column that already exists will raise and exception
Definition at line 255 of file Database.py.
def IMP.em2d.Database.Database2.create_table | ( | self, | |
table_name, | |||
column_names, | |||
column_types | |||
) |
It expects a sorted dictionary of (data_field,typename) entries
Definition at line 45 of file Database.py.
def IMP.em2d.Database.Database2.create_view | ( | self, | |
view_name, | |||
table_name, | |||
condition_fields, | |||
condition_values | |||
) |
See the help for update_data()
Definition at line 144 of file Database.py.
def IMP.em2d.Database.Database2.store_data | ( | self, | |
table_name, | |||
data | |||
) |
The info must be a list of tuples containing as many values as columns in the table Conversion of values is done AUTOMATICALLY after checking the types stored in the table
Definition at line 94 of file Database.py.
def IMP.em2d.Database.Database2.store_dataV1 | ( | self, | |
table_name, | |||
data | |||
) |
The info must be a list of tuples containing as many values as columns in the table Conversion of values is done AUTOMATICALLY after checking the types stored in the table
Definition at line 72 of file Database.py.