|
I've observed that when I create a table with an INTEGER ZEROFILL column, MariaDB Connector/Python raises ValueError getting results. However, MySQL Connector/Python seems working well and returns `23987` in the provided test case.
The test case:
def execute_and_print(con, sql):
|
try:
|
cursor = con.cursor()
|
cursor.execute(sql)
|
column_type = [m[1] for m in cursor.description]
|
print('column type', *column_type, sep=' * ')
|
for row in cursor:
|
print(*row, sep=' * ')
|
cursor.close()
|
except Exception as e:
|
raise e
|
|
def execute(con, sql):
|
try:
|
cursor = con.cursor()
|
cursor.execute(sql)
|
cursor.close()
|
except Exception as e:
|
raise e
|
|
conn_params = {
|
"user": "root",
|
"password": "password",
|
"host": "127.0.0.1"
|
}
|
|
con = mariadb.connect(**conn_params)
|
execute(con, "DROP DATABASE IF EXISTS test")
|
execute(con, "CREATE DATABASE test")
|
execute(con, "USE test")
|
execute(con, "CREATE TABLE IF NOT EXISTS t0(c0 INTEGER ZEROFILL)")
|
execute(con, "INSERT INTO t0 VALUES(23987)")
|
execute_and_print(con, "SELECT * FROM t0")
|
con.close()
|
|