Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

MySQL ADBC driver ignores the target schema when creating an ingest table

Abierto
#258 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
mysql, python
Área
database

Línea de trabajo

The workaround lives in xarray_sql/backends/adbc.py, in _default_database, which switches the connection's default database for MySQL and MariaDB. The root bug is in the upstream adbc-drivers/mysql driver, so the first step is to reproduce it with the snippet in the issue and file the upstream report. Done here means the upstream issue exists and test_mysql_mixed_dimensions_register_in_a_database passes with XARRAY_SQL_TEST_MYSQL_URI set; removing the workaround waits for a fixed driver release.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Summary

The ADBC Driver Foundry's MySQL driver (0.6.1, the latest release at the time of writing) ignores the target schema when it creates the table for an ingest. Given db_schema_name, it creates the table in the connection's default database, then inserts into the target database, so the ingest fails.

#255 works around this in the ADBC adapter. This issue tracks the workaround until the driver is fixed.

Reproduction

MySQL 8.4.11, adbc-driver-manager 1.12.0, MySQL driver 0.6.1 (dbc install mysql):

import pyarrow as pa
from adbc_driver_manager import dbapi

con = dbapi.connect(driver="mysql", db_kwargs={"uri": "mysql://[email protected]:3306/xql"})
with con.cursor() as cur:
    cur.execute("CREATE DATABASE IF NOT EXISTS era5")
    cur.adbc_ingest("surface", pa.table({"x": [1.0]}), mode="create", db_schema_name="era5")
  • Expected: a table era5.surface holding one row.

  • Actual:

    ProgrammingError: NOT_FOUND: [MySQL] failed to prepare batch insert statement:
    Error 1146 (42S02): Table 'era5.surface' doesn't exist.
    

    The table was created as xql.surface, in the connection's default database, according to information_schema.tables.

Workaround in xarray-sql

For MySQL and MariaDB, xarray_sql/backends/adbc.py doesn't pass db_schema_name at all. Instead, _default_database makes the target database the connection's default (USE era5) for the duration of the ingest, then restores the previous default. MySQL can't unset a default database, so a connection that had no default keeps the target afterwards.

This is how mixed-dimension Datasets register as era5.<group> on MySQL. test_mysql_mixed_dimensions_register_in_a_database covers it; the test runs when XARRAY_SQL_TEST_MYSQL_URI is set.

Next steps

  • Report upstream at adbc-drivers/mysql (no existing issue covered it at the time of writing).
  • Once a fixed driver is released, remove _default_database and pass db_schema_name through on MySQL, as on every other database.

🤖 Generated with Claude Code

Lenguaje dominante
Python
Estrellas
142
Forks
19
Merge medio
1 d 9 h
PR fusionados (30 d)
9

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de xqlsystems/xarray-sql

Todos los issues de xqlsystems/xarray-sql

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.