corgidb.objects.Table.cols
Table.cols(dtype: str="Python", withid: bool=False)this method will return table columns and dtype of each column
Parameters
dtype: str
choose default output for data type can be selected either
"Python"or"SQL"if selected python dtype out will be a type object and string for SQL., e.g.
"LONGTEXT"withid: bool
to include
row_idcolumns or not
Returns
out: dict
dictionary with columns name as key and datatype as value, e.g.
{"name": str},{"name":"LONGTEXT"}
Examples
from corgidb import CorgiDB
cdb = CorgiDB(database_path="db.sqlite")
tb = cdb.get_table(name="Personnel")
tb.cols()
## OUT
{
"name": str,
"age" : int
}
Last updated