MySQL ADBC driver ignores the target schema when creating an ingest table
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.surfaceholding 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 toinformation_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_databaseand passdb_schema_namethrough on MySQL, as on every other database.
🤖 Generated with Claude Code
- Vorherrschende Sprache
- Python
- Sterne
- 142
- Forks
- 19
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 9
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus xqlsystems/xarray-sql
-
documentation
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 85/100
xqlsystems/xarray-sql#268 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
xqlsystems/xarray-sql#267 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 74/100
xqlsystems/xarray-sql#243 ·
Maintainer antworten meist innerhalb von 1 Tag
-
publish.yml: the TestPyPI verification step is unreachable (and installs the wrong package name)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
xqlsystems/xarray-sql#242 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
xqlsystems/xarray-sql#237 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in xqlsystems/xarray-sql
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
SACGF/variantgrid#2341 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 2 Tagen
-
comp/cli P3 type/security
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
NousResearch/hermes-agent#141420 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
CKV_GCP_18 (GKEPublicControlPlane) passes when master_authorized_networks_config is absent, control plane is internet-reachableEvtl. vergeben @Varshith-Kali hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
bridgecrewio/checkov#7753 ·
Maintainer antworten meist innerhalb von 1 Tag