Embedded Python Real-Time FrameWork : API
Build 20250616.1
|
Resilient pyodbc connection to ODBC d/b. More...
Classes | |
class | GLodbc |
A connection to an ODBC data source, usually a specific database. More... | |
Functions | |
def | BuildInsert |
Builds an INSERT statement from list of columns and values. More... | |
def | GetColHdr |
Return list of column headers. More... | |
def | GetColInfo |
Return column headers for 'tbl'. More... | |
def | GetColTypes |
Query d/b for column types for a list of column names. More... | |
def | Insert |
Execute a list of prebuilt INSERT statements. More... | |
def | Query |
Execute SELECT statement. More... | |
def | RawQuery |
Execute raw query. More... | |
def | SyncInsert |
Blocking Insert. More... | |
def | Update |
Execute UPDATE command. More... | |
def | Value2String |
Returns string-ified version of native Python type. More... | |
Variables | |
_err | |
_state | |
[ row for row in rows ] More... | |
_sts | |
_tQry | |
Resilient pyodbc connection to ODBC d/b.
def pyRT.gatea.sys.GLodbc.BuildInsert | ( | self, | |
tbl, | |||
cols, | |||
vals | |||
) |
Builds an INSERT statement from list of columns and values.
tbl | - Table name |
cols | - List of column names |
vals | - List of values |
def pyRT.gatea.sys.GLodbc.GetColHdr | ( | self, | |
tbl | |||
) |
Return list of column headers.
Currently this function only supports the MySQL DESCRIBE command
tbl | - Table Name |
def pyRT.gatea.sys.GLodbc.GetColInfo | ( | self, | |
tbl, | |||
bType = False |
|||
) |
Return column headers for 'tbl'.
From https://github.com/mkleehammer/pyodbc/wiki/Cursor:
Each tuple contains:
We return a list of Column Names or Types, depending on bType
tbl | - Table name |
bType | - True to return Type; False for names |
def pyRT.gatea.sys.GLodbc.GetColTypes | ( | self, | |
tbl, | |||
flds | |||
) |
Query d/b for column types for a list of column names.
Return values is a string list of type mnemonics:
Mnemonic | Data Type |
---|---|
D | datetime |
i | int |
l | long |
d | double |
s | string |
u | unicode |
tbl | - Table name |
flds | - List of Fields to query |
def pyRT.gatea.sys.GLodbc.Insert | ( | self, | |
inserts | |||
) |
def pyRT.gatea.sys.GLodbc.Query | ( | self, | |
sel, | |||
tbl = None |
|||
) |
Execute SELECT statement.
sel | - SELECT statement |
tbl | - Table; If provided, append 'from s' % tbl |
def pyRT.gatea.sys.GLodbc.RawQuery | ( | self, | |
qry | |||
) |
Execute raw query.
qry | - Raw Query |
def pyRT.gatea.sys.GLodbc.SyncInsert | ( | self, | |
inserts | |||
) |
Blocking Insert.
inserts | - Semi-colon separated list of statements |
def pyRT.gatea.sys.GLodbc.Update | ( | self, | |
stmt | |||
) |
Execute UPDATE command.
stmt | - UPDATE command |
def pyRT.gatea.sys.GLodbc.Value2String | ( | self, | |
val, | |||
ty, | |||
sigFig = '%.6f' |
|||
) |
Returns string-ified version of native Python type.
Data Types from the following table:
Mnemonic | Data Type |
---|---|
D | datetime |
i | int |
l | long |
d | double |
s | string |
u | unicode |
val | - Value to convert |
ty | - Type mnemonic from above) |
sigFig | - Formatting string for double; Default is %.6f |
pyRT.gatea.sys.GLodbc._err |
pyRT.gatea.sys.GLodbc._state |
[ row for row in rows ]
pyRT.gatea.sys.GLodbc._sts |
pyRT.gatea.sys.GLodbc._tQry |