Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add MariaDB-specific reflection #522

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tomkcook
Copy link

@tomkcook tomkcook commented Aug 27, 2024

Description

Fixes: #521

This resolves #521 -- at least for me -- by adding a MariaDB-specific query for geometry column reflection.

Apologies that I am out of time today to add a test case. I'll look into it tomorrow.

Checklist

This pull request is:

  • A documentation / typographical error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • Please include: Fixes: #<issue number> in the description if it solves an existing issue
      (which must include a complete example of the issue).
    • Please include tests that fail with the main branch and pass with the provided fix.
  • A new feature implementation or update an existing feature
    • Please include: Fixes: #<issue number> in the description if it solves an existing issue
      (which must include a complete example of the feature).
    • Please include tests that cover every lines of the new/updated feature.
    • Please update the documentation to describe the new/updated feature.

@tomkcook
Copy link
Author

TBH I struggle a bit to articulate a test that would fail without this change and pass with it, at least within the current test regime. I can see two options:

  • Set up a separate test_functional_mariadb.py that replicates most of test_functional_mysql.py but with a MariaDB database instead of a MySQL one.
  • Write a test that exercises reflect_geometry_column() specifically, mock out the engine and check that the executed SQL includes the SRS_ID column if the dialect is MySQL but not if it's MariaDB.

Do the maintainers have a preference for which approach to take?

@adrien-berchet
Copy link
Member

Hi @tomkcook,
Sorry for the delay, I'm currently on vacation.
Thank you very much for pointing this issue out and for proposing a solution. As far as I can see, your solution looks good but it could be reworked to be a bit more compact and to avoid duplicated code. And for your question, I think that just one test for reflect_geometry_column is enough.
I will have some time next week to review this more carefully.

per review suggestion

Co-authored-by: Adrien Berchet <adrien.berchet@gmail.com>
@adrien-berchet
Copy link
Member

Hi @tomkcook !
I made a few tests in #524 and I realized that MariaDB was not as close to MySQL as I expected, so I think it should be processed as a complete different dialect. Nevertheless, there is something I don't understand: I could not find a way to insert a geometry using a WKB string, is it possible? Otherwise we will have to convert all WKB strings into WKT strings, which is quite bad for perf.

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.

[Bug report] Reflection fails in mariadb
3 participants