Parses data types from a dictionary or list of dictionaries.
The dictionary keys will be paired with the types of the corresponding values, e.g.:
(key, type(data[key]))
If there are multiple dictionaries that have the same keys, the value types should be the same across dictionaries (with the exception of NoneType).
For example:
dict_to_dtypes(data=[
{'name': 'apple', 'fruit': True, 'tree': True},
{'name': 'tomato', 'fruit': True, 'tree': False},
{'name': 'cucumber', 'fruit': False, 'tree': False}
])
will return:
[('fruit', bool), ('name', str), ('tree', bool)]
Parameters : | data : dictionary or list of dictionaries
order : list of strings (optional)
|
---|---|
Returns : | dtypes : list of 2-tuples
|
Execute a SQL command cmd in database db.
Parameters : | db : string
cmd : string or list
fetchall : bool (optional)
verbose : bool (optional)
|
---|---|
Returns : | result : list or None
|