Details
-
New Feature
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
N/A
-
None
-
3.8+
Description
The cursor description as defined in PEP-249 doesn't cover all metadata provided from MariaDB server.
Instead of extending description cursor should provide a new property 'metadata', which returns all metadata information as a dictionary.
Example:
import mariadb |
|
conn=mariadb.connect(user="root", db="test") |
cursor=conn.cursor() |
|
cursor.execute("create or replace table t1 (a json, b text, c uuid, d int)") |
cursor.execute("select * from t1") |
print(cursor.metadata) |
Output:
{'catalog': ('def', 'def', 'def', 'def'), 'schema': ('test', 'test', 'test', 'test'), 'field': ('a', 'b', 'c', 'd'), 'org_field': ('a', 'b', 'c', 'd'), 'table': ('t1', 't1', 't1', 't1'), 'org_table': ('t1', 't1', 't1', 't1'), 'type': (252, 252, 254, 3), 'charset': (45, 45, 45, 63), 'length': (4294967295, 262140, 144, 11), 'max_length': (0, 0, 0, 0), 'decimals': (0, 0, 0, 0), 'flags': (144, 16, 160, 32768), 'ext_type_or_format': (1, 0, 2, 0)}
|
ext_type_or_format values will be defined in constants/EXT_FIELD_TYPE.py:
NONE =0 |
JSON = 1 |
UUID = 2 |
INET4 = 3 |
INET6 = 4 |
POINT = 5 |
MULTIPOINT = 6 |
LINESTRING = 7 |
MULTILINESTRING = 8 |
POLYGON = 9 |
MULTIPOLYGON = 10 |
GEOMETRYCOLLECTION = 11 |
Attachments
Issue Links
- blocks
-
CONPY-270 string coercion not applied to UUID when value is in RETURNING, contradicting cursor.description
- Closed