Hi LangChain team,
We maintain the `langchain-polardbx` partner package (currently a VectorStore integration for PolarDB-X, registered in the docs repo).
We’d like to also provide `SQLDatabase` support in the same package, so users can use both vector and SQL capabilities from a single install. The technical reason is that PolarDB-X has minor DDL format differences in `SHOW CREATE TABLE` output (tab indentation, ENUM value spacing) that break SQLAlchemy’s default MySQL reflection parser. Our solution is a custom SQLAlchemy dialect (`PolarDBXDialect`) that subclasses the existing MySQL dialect and overrides only the table definition parser — **zero monkey-patching, zero global side effects**. Users who don’t use our dialect are completely unaffected.
Could you advise:
- Is it acceptable for a partner package to include `SQLDatabase` alongside `VectorStore`?
- If not, would a separate `langchain-polardbx-sql` package be preferred?
Thanks!
Hi, @Jiniqi-ty!
First off, thanks so much for the community contribution!
There isn’t a hard rule on how you package these. But, looking at how you’ve implemented it, I would recommend publishing the dialect as its own sqlalchemy-polardbx (or similar) package.
Then just add a docs example under the existing langchain-polardbx page showing SQLDatabase.from_uri(...).
If you want a nice pip UX, langchain-polardbx can declare sqlalchemy-polardbx as an optional extra (pip install langchain-polardbx[sql]).
Like I said, this is just my suggestion.
Thanks for the thoughtful suggestion, Dariel!
For now, we’ll keep it in the existing `langchain-polardbx` package with a `[sql]` optional extra (`pip install langchain-polardbx[sql]`). The dialect code is quite small (~15 lines of logic), so the overhead of a separate package didn’t seem justified yet. We’ll add a docs example for `SQLDatabase.from_uri(…)` as you mentioned.
If the dialect grows significantly or we see demand from non-LangChain users, we’ll definitely reconsider splitting it into a standalone `sqlalchemy-polardbx` package — that’s a great long-term direction.
Appreciate the guidance!