Python Connector for MySQL

Data types - Python Connector for MySQL

Data types

The following table describes the supported MySQL data types and their mapping to the Python data types. The type codes returned in the description cursor attribute can be used in the addtypecast() cursor method.

MySQL data type Type code Python data type

CHAR

220

str

VARCHAR

221

str

ENUM

228

str

SET

229

str

TINYTEXT

226

str

MEDIUMTEXT

233

str

TEXT

227

str

LONGTEXT

232

str

JSON

234

str

BIT

201

int

TINYINT

202

int

TINYINT UNSIGNED

203

int

SMALLINT

204

int

SMALLINT UNSIGNED

205

int

MEDIUMINT

206

int

MEDIUMINT UNSIGNED

207

int

INT

208

int

INT UNSIGNED

209

int

BIGINT

210

int

BIGINT UNSIGNED

211

int

YEAR

219

int

DECIMAL

214

float

FLOAT

212

float

DOUBLE

213

float

DATE

215

datetime.date

TIME

216

datetime.time

DATETIME

217

datetime.datetime

TIMESTAMP

218

datetime.datetime

BINARY

222

binary

VARBINARY

223

binary

TINYBLOB

224

bytes

BLOB

225

bytes

MEDIUMBLOB

231

bytes

LONGBLOB

230

bytes

© 2022-2025 Devart. All Rights Reserved. Request Support Python Connectors Forum Provide Feedback