Classes | |
class | DBCholeError |
Error returned by database_chole. More... | |
Functions | |
def | create_table |
Create a chole table data in a database For a table name, create all the attributes. More... | |
def | row2dict |
Classic SQLite routine for transforming a row of tuple into a dictionnary. More... | |
def | open_db |
Open DB in dictionnary mode. More... | |
def | init_db |
Initialise output database file. More... | |
def | find_element |
Find an element in 1 or multiple tables. More... | |
def | add_element |
Add an element in a table. More... | |
def | update_element |
Update an element in a table through its ID. More... | |
def | delete_element |
Delete an element in a table through its ID. More... | |
def | compare_element |
Compare 2 db_elements. More... | |
def | printdiff_element |
Show differences between 2 db_elements. More... | |
def | fetch_level_choice |
For a given table_name, return the file fetch level it should use. More... | |
def | datetime2file |
Look for the file of corresponding coronal hole file for an given day. More... | |
def | nearest_sup |
Look for the nearest and newer coronal hole file for an given day. More... | |
def | nearest_inf |
Look for the nearest and older coronal hole file for an given day. More... | |
def | build_db |
Build the SW database for all files available and for a given table. More... | |
Variables | |
tuple | database_path = os.path.join(path_db,'chole.db') |
list | database_tables |
list | attributes = [] |
def database.database_chole.add_element | ( | table_name, | |
connector, | |||
cursor, | |||
kwargs | |||
) |
Add an element in a table.
If found 0 corresponding element, just add it.
If found more than 1 corresponding element, raise DBCholeError.
def database.database_chole.build_db | ( | table_name, | |
db_file, | |||
verbose = 1 |
|||
) |
Build the SW database for all files available and for a given table.
Verbose = 0 or False: no verbose
Verbose = 1 or True: some basic
Verbose > 1: more verbose
Will look into folder corresponding to fetch type
def database.database_chole.compare_element | ( | db1, | |
db2 | |||
) |
Compare 2 db_elements.
For all attribute names (see database_chole_attributes), check if db1[attr_name] == db2[attr_name].
def database.database_chole.create_table | ( | connector, | |
table_name | |||
) |
Create a chole table data in a database For a table name, create all the attributes.
def database.database_chole.datetime2file | ( | table_name, | |
date_in, | |||
h_accuracy = 3 |
|||
) |
Look for the file of corresponding coronal hole file for an given day.
def database.database_chole.delete_element | ( | table_name, | |
connector, | |||
cursor, | |||
element_id | |||
) |
Delete an element in a table through its ID.
def database.database_chole.fetch_level_choice | ( | table_name | ) |
For a given table_name, return the file fetch level it should use.
def database.database_chole.find_element | ( | table_names, | |
connector, | |||
cursor, | |||
kwargs | |||
) |
Find an element in 1 or multiple tables.
[in] | table_names | list of 1 or multiple table names |
[in] | connector | |
[in] | cursor | |
[in] | kwargs | optional arguments corresponding to database_chole_attributes and their values |
[out] | results | list DB element found |
def database.database_chole.init_db | ( | db_file, | |
verbose_in | |||
) |
Initialise output database file.
If already exists, replace it. Old db kept into .old.
Verbose = 0 or False: no verbose
Verbose = 1 or True: some basic
Verbose > 1: more verbose
def database.database_chole.nearest_inf | ( | table_name, | |
date_in | |||
) |
Look for the nearest and older coronal hole file for an given day.
def database.database_chole.nearest_sup | ( | table_name, | |
date_in | |||
) |
Look for the nearest and newer coronal hole file for an given day.
def database.database_chole.open_db | ( | db_filename | ) |
Open DB in dictionnary mode.
def database.database_chole.printdiff_element | ( | db1, | |
db2 | |||
) |
Show differences between 2 db_elements.
For all attribute names (see database_chole_attributes), if db1[attr_name] != db2[attr_name] print their respective value.
def database.database_chole.row2dict | ( | cursor, | |
row | |||
) |
Classic SQLite routine for transforming a row of tuple into a dictionnary.
Usage: conn comes from sqlite3.connect(db_file)
conn.row_factory = row2dict
IN FACT NO NEED FOR IT!!!
Just call conn.row_factory = sqlite3.Row
def database.database_chole.update_element | ( | table_name, | |
connector, | |||
cursor, | |||
element_id, | |||
kwargs | |||
) |
Update an element in a table through its ID.
list database.database_chole.attributes = [] |
tuple database.database_chole.database_path = os.path.join(path_db,'chole.db') |
list database.database_chole.database_tables |