MySQL/MariaDB Driver v0.7.0¶
Driver Version v0.7.0 Release Date 2026-10-09 Tested With MySQL 9.7 Tested With MariaDB 12.2 Tested With Databend 12.2
This driver provides access to MySQL and MariaDB , free and open-source relational database management systems.
Installation¶
The MySQL driver can be installed with dbc :
dbc install mysql
Connecting¶
To connect, edit the uri option below to match your environment and run the following:
from adbc_driver_manager import dbapi
conn = dbapi.connect(
driver="mysql", db_kwargs={"uri": "mysql://root@localhost:3306/demo"}
)
Note: The example above is for Python using the adbc-driver-manager package but the process will be similar for other driver managers. See adbc-quickstarts .
Connection String Format¶
Connection strings are passed with the uri option. The driver supports two formats:
MySQL URI Format (Recommended)¶
The standard MySQL URI format, following MySQL’s official specification:
mysql://[user[:[password]]@]host[:port][/schema][?attribute1=value1&attribute2=value2...]
Examples:
mysql://localhost/mydbmysql://user:pass@localhost:3306/mydbmysql://user:pass@host/db?charset=utf8mb4&timeout=30smysql://user@(/path/to/socket.sock)/db(Unix domain socket)mysql://user@localhost/mydb(no password)
URI Components:
scheme:mysql://(required)user: Optional (for authentication)password: Optional (for authentication, requires user)host: Required (must be explicitly specified)port: Optional (defaults to 3306)schema: Optional (can be empty, MySQL database name)Query params: MySQL connection attributes
Note
Reserved characters in URI elements must be URI-encoded. For example, @ becomes %40. If you include a zone ID in an IPv6 address, the % character used as the separator must be replaced with %25.
Unix Domain Sockets:
When connecting via Unix domain sockets, use the parentheses syntax to wrap the socket path: mysql://user@(/path/to/socket.sock)/db
For complete details, see MySQL’s URI-like connection string format and Connection Parameters documentation.
Go MySQL Driver DSN Format (Alternative)¶
The driver also accepts the Go MySQL Driver DSN format :
[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...¶mN=valueN]
Examples:
user:pass@tcp(localhost:3306)/mydbuser@tcp(127.0.0.1:3306)/mydbuser:pass@unix(/tmp/mysql.sock)/mydb
Feature & Type Support¶
| Feature | MySQL | MariaDB | Databend | |
|---|---|---|---|---|
| Bind Parameters | ✅ | ❌ | ||
| Bulk Ingestion | Create | ✅ | ❌ | |
| Append | ✅ | ❌ | ||
| Create/Append | ✅ | ❌ | ||
| Replace | ✅ | ❌ | ||
| Temporary Table | ✅ | ❌ | ||
| Target Catalog | ✅ | ❌ | ||
| Target Schema | ❌ | |||
| Non-nullable fields are marked NOT NULL | ❌ | |||
| Catalog (GetObjects) | depth=catalogs | ✅ | ❌ | |
| depth=db_schemas | ✅ | ❌ | ||
| depth=tables | ✅ | ❌ | ||
| depth=columns (all) | ✅ | ❌ | ||
| Get Parameter Schema | ❌ | |||
| Get Table Schema | ✅ | ❌ | ||
| Prepared Statements | ✅ | ❌ | ||
| Transactions | ✅ | |||
Catalog and Schema Support¶
MySQL only has databases. The driver treats MySQL databases as catalogs and leaves schemas empty. To explicitly specify the database name when querying the catalog, bulk ingesting, or in other operations, pass it as the ADBC catalog.
Types¶
Database to Arrow¶
| Database Type | MySQL | MariaDB | Databend |
|---|---|---|---|
|
BIGINT |
int64 |
||
|
BIGINT UNSIGNED |
uint64 |
(NA/not tested) |
|
|
BIT |
binary |
(NA/not tested) |
|
|
BOOLEAN |
int64, int8 ⚠️ [1] |
int32, int8 ⚠️ [1] |
int16 |
|
DATE |
date32[day] |
||
|
DATETIME |
timestamp[ms], timestamp[s], timestamp[us] ⚠️ [1] |
(NA/not tested) |
|
|
DECIMAL |
(NA/not tested) |
❌ |
|
|
DOUBLE PRECISION |
double |
||
|
INT |
int32 |
||
|
JSON |
extension<arrow.json> |
string |
(NA/not tested) |
|
NUMERIC |
decimal64 |
(NA/not tested) |
|
|
REAL |
float |
||
|
SMALLINT |
int16 |
||
|
TIME |
time64[us] |
(NA/not tested) |
|
|
TIMESTAMP |
timestamp[ms] (with time zone), timestamp[s] (with time zone), timestamp[us], timestamp[us] (with time zone) ⚠️ [1] |
timestamp[s] |
|
|
TIMESTAMP(0) |
(NA/not tested) |
timestamp[s] |
|
|
TIMESTAMP(0) WITH TIME ZONE |
(NA/not tested) |
❌ |
|
|
TIMESTAMP(p) (1 <= p <= 3) |
(NA/not tested) |
timestamp[s] |
|
|
TIMESTAMP(p) (1 <= p <= 3) WITH TIME ZONE |
(NA/not tested) |
❌ |
|
|
TIMESTAMP(p) (4 <= p <= 6) |
(NA/not tested) |
timestamp[s] |
|
|
TIMESTAMP(p) (4 <= p <= 6) WITH TIME ZONE |
(NA/not tested) |
❌ |
|
|
TIMESTAMP_TZ |
(NA/not tested) |
❌ |
|
|
VARBINARY |
binary |
||
|
VARCHAR |
string |
||
Arrow to Database¶
| Arrow Type | MySQL Type | MariaDB Type | Databend Type | ||
|---|---|---|---|---|---|
| Bind | Ingest | Bind | Ingest | Ingest | |
|
binary |
VARBINARY |
❌ |
|||
|
binary_view |
VARBINARY |
❌ |
|||
|
bool |
BOOLEAN |
❌ |
|||
|
date32[day] |
DATE |
❌ |
|||
|
decimal128 |
DECIMAL |
DECIMAL ⚠️ [2] |
DECIMAL |
DECIMAL ⚠️ [2] |
❌ |
|
double |
DOUBLE PRECISION |
❌ |
|||
|
fixed_size_binary |
VARBINARY |
❌ |
|||
|
float |
REAL |
❌ |
REAL |
❌ |
|
|
halffloat |
REAL |
(NA/not tested) |
REAL |
(NA/not tested) |
|
|
int16 |
SMALLINT |
❌ |
|||
|
int32 |
INT |
❌ |
|||
|
int64 |
BIGINT |
❌ |
|||
|
large_binary |
VARBINARY |
❌ |
|||
|
large_string |
VARCHAR |
❌ |
|||
|
string |
VARCHAR |
❌ |
|||
|
string_view |
VARCHAR |
❌ |
|||
|
time32[ms] |
TIME |
❌ |
|||
|
time32[s] |
TIME |
❌ |
|||
|
time64[ns] |
TIME |
❌ |
|||
|
time64[us] |
TIME |
❌ |
|||
|
timestamp[ms] |
DATETIME |
❌ |
|||
|
timestamp[ms] (with time zone) |
TIMESTAMP |
❌ |
|||
|
timestamp[ns] |
DATETIME |
❌ |
|||
|
timestamp[ns] (with time zone) |
TIMESTAMP |
❌ |
|||
|
timestamp[s] |
DATETIME |
❌ |
|||
|
timestamp[s] (with time zone) |
TIMESTAMP |
❌ |
|||
|
timestamp[us] |
DATETIME |
❌ |
|||
|
timestamp[us] (with time zone) |
TIMESTAMP |
❌ |
|||
|
uint16 |
SMALLINT UNSIGNED |
(NA/not tested) |
|||
|
uint32 |
INT UNSIGNED |
(NA/not tested) |
|||
|
uint64 |
BIGINT UNSIGNED |
(NA/not tested) |
|||
|
uint8 |
TINYINT UNSIGNED |
(NA/not tested) |
|||
Options¶
mysql.query.zero_datetime_behaviorValues:
error,convert_to_null. Default:error.Control what to do with DATE and TIMESTAMP values that contain zero components in the date (e.g.
0000-00-00), which MySQL allows for backwards compatibility. By default, this will error;convert_to_nullwill instead treat these values as equivalent to null.mysql.vendorValues:
mysql,mariadb,databend, or another backend identifier. Default:mysql.Controls whether the driver injects MySQL’s UTC session timezone parameter into the DSN. Leave this unset for MySQL and MariaDB to use MySQL’s
time_zone. Other non-MySQL backends, including Databend, still get UTC client-side timestamp parsing, but no session timezone parameter is injected.
Compatibility¶
This driver was tested on:
MySQL
0 (0)MySQL
12.2.2-MariaDB-ubu2404 (mariadb.org binary distribution)MySQL
9.7.2 (MySQL Community Server - GPL)
Previous Versions¶
To see documentation for previous versions of this driver, see the following: