Skip to content

Fix (mysql): Fix failing test for MySQL dialect#567

Merged
adrien-berchet merged 5 commits intomasterfrom
fix-mysql-transform-test
Aug 18, 2025
Merged

Fix (mysql): Fix failing test for MySQL dialect#567
adrien-berchet merged 5 commits intomasterfrom
fix-mysql-transform-test

Conversation

@google-labs-jules
Copy link
Copy Markdown
Contributor

@google-labs-jules google-labs-jules bot commented Aug 8, 2025

This change fixes the failing test 'tests/test_functional.py::TestInsertionORM::test_transform' for the MySQL dialect. The issue was that the test was using the ST_AsEWKB function, which is not available in MySQL. This was addressed by adding a compilation rule for ST_AsEWKB in geoalchemy2/admin/dialects/mysql.py. This rule makes ST_AsEWKB compile to ST_AsWKB(ST_SRID(geom, srid)) for MySQL and MariaDB, which solves the issue of the missing function and the incorrect SRID.

Edit: the bot was quite wrong and its explanation should only be considered as a first lead.

google-labs-jules bot and others added 5 commits August 8, 2025 21:28
This fixes the failing test 'tests/test_functional.py::TestInsertionORM::test_transform' for the MySQL dialect.

The test was failing because it was using the `ST_AsEWKB` function, which is not available in MySQL. This was addressed by adding a compilation rule for `ST_AsEWKB` in `geoalchemy2/admin/dialects/mysql.py`. This rule makes `ST_AsEWKB` compile to `ST_AsWKB(ST_SRID(geom, srid))` for MySQL and MariaDB, which solves the issue of the missing function and the incorrect SRID.
This fixes the failing test 'tests/test_functional.py::TestInsertionORM::test_transform' for the MySQL dialect.

The test was failing because it was using the `ST_AsEWKB` function, which is not available in MySQL. This was addressed by adding a compilation rule for `ST_AsEWKB` in `geoalchemy2/admin/dialects/mysql.py`. This rule makes `ST_AsEWKB` compile to `ST_AsWKB(ST_SRID(geom, srid))` for MySQL and MariaDB, which solves the issue of the missing function and the incorrect SRID.

The `TransformedGeometry` decorator in the tests was also updated to correctly handle the SRID transformation by using the `load_dialect_impl` method to provide a dialect-specific implementation of the type.
@adrien-berchet adrien-berchet changed the title Fix failing test for MySQL dialect Test: Fix failing test for MySQL dialect Aug 18, 2025
@adrien-berchet adrien-berchet marked this pull request as ready for review August 18, 2025 12:25
@adrien-berchet adrien-berchet changed the title Test: Fix failing test for MySQL dialect Fix (mysql): Fix failing test for MySQL dialect Aug 18, 2025
@adrien-berchet adrien-berchet merged commit 3d60995 into master Aug 18, 2025
8 checks passed
@adrien-berchet adrien-berchet deleted the fix-mysql-transform-test branch August 18, 2025 12:38
@adrien-berchet adrien-berchet mentioned this pull request Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant