gorilla-co / odata-query

An OData v4 query parser and transpiler for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for SQLAlchemy Core

meitham opened this issue · comments

Hi there,

Thank you for making this lovely library.

I currently use the AstToSqlAlchemyClauseVisitor which works well with SQLAlchemy ORM, but my application is async so I use sqlalchemy core everywhere apart from where OData is involved. My database does not support async driver so sqlalchemy 2.0 async support won't actually bring an difference to me. With sqlalchemy core I build the query statements and handle all aspects around execution of the statement myself with loop.run_in_executor, which again does not work well with ORM.

Would it possible to add support for sqlalchemy core?

Hey, thanks for the kind words!

It would make a ton of sense to support SQLAlchemy Core, and judging from your PR (thanks a ton!) the implementation isn't even that different from the ORM. I'll try to review this today and get a release out ASAP.

Thanks for the contribution and feedback! I've merged the PR, done some minor refactoring, and updated the docs. This will be present in the v0.7.0 release, which would be released right now if PyPI wasn't in maintenance mode.

I couldn't find a clear way to get relationship traversal working in Core, so I added some warnings to the docs and NotImplementedErrors in the code. I created a follow-up ticket for that functionality: #32 .

Hopefully this works for your case!