watex.geology.database.DBSetting#

class watex.geology.database.DBSetting(db_name=None, db_host=None)[source]#

build a datable postgre Sql from dict_app.py simple way to make a transit between two objects One object dict_app to populate DataBase

Parameters:
  • **db_name** (str) – name of dataBase

  • **db_host** (st) – path to database

  • informations (Hold other additional)

  • ==================================== (==================== ==============)

  • Explanation (Attributes Type)

  • ====================================

  • connection (connex object DataBase)

  • cursor (closeDB close after requests the connection and the)

  • ====================================

  • =============================================== (==========================) – Methods Explanation

  • ===============================================

  • dataBase (dicT_sqlDB send infos as dictionnary to)

  • sql_request (execute req execute a)

  • Table (drop_TableDB drop all Tables in sql memory DB or single)

  • cursor

  • data (commit transfer the data to DataBase. if not the) – will still in the cursor and not in the dataBase

  • system (print_last_Query print the last operating)

  • . (export_req export the request on datasheet like excelsheet)

  • ===============================================

Examples

>>> from watex.geology.database import DBSetting
>>> path= os.getcwd()
>>> nameofDB='memory.sq3'
>>> manDB=DBSetting(db_name=nameofDB,
...                   db_host=path)
... print(SqlQ.sql_req[-1])
... manDB.executeReq(SqlQ.sql_req[2])
... ss=manDB.print_last_Query()
... print(ss)
... manDB.export_req(SqlQ.sql_req[-1],
                     export_type='.csv')
... manDB.dicT_sqlDB(dictTables=Glob.dicoT,
                   visualize_request=False)