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

Functions returning Box types now return None types instead of Geometry types #375

Merged
merged 4 commits into from
Mar 19, 2022

Conversation

EdwardBetts
Copy link
Contributor

Version 0.9.0 broke my code. My query was returning a string from Box2D(), since version 0.9.0 the call to Box2D() gets wrapped by ST_AsEWKB. This change fixes my problem so I can get a string back from Box2D().

Version 0.9.0 broke my code. My query was returning a string from Box2D(), since version 0.9.0 the call to Box2D() gets wrapped by ST_AsEWKB. This change fixes my problem so I can get a string back from Box2D().
@EdwardBetts
Copy link
Contributor Author

from geoalchemy2 import Geometry
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy import func

session = scoped_session(sessionmaker())

stmt = session.query(func.ST_Dump(Geometry()).label("x")).subquery()

print(session.query(func.Box2D(stmt.c.x.geom)))

@adrien-berchet
Copy link
Member

Hi @EdwardBetts
Thanks for this, it's indeed probably better for now. Maybe I will add a Box type later but for now let's not wrap it.
Could you just also remove the wrapping for Box3D please?

geoalchemy2/_functions.py Outdated Show resolved Hide resolved
@EdwardBetts
Copy link
Contributor Author

Will do

EdwardBetts and others added 2 commits March 19, 2022 06:54
Co-authored-by: Adrien Berchet <adrien.berchet@gmail.com>
@adrien-berchet adrien-berchet changed the title Fix to stop Box2D being wrapped with ST_AsEWKB Functions returning Box types now return None types instead of Geometry types Mar 19, 2022
@adrien-berchet
Copy link
Member

adrien-berchet commented Mar 19, 2022

Thanks @EdwardBetts , I updated a few other functions for consistency, does it look good to you?

@EdwardBetts
Copy link
Contributor Author

Looks good to me.

@adrien-berchet adrien-berchet merged commit b226208 into geoalchemy:master Mar 19, 2022
@adrien-berchet
Copy link
Member

Thanks!

@EdwardBetts EdwardBetts deleted the patch-1 branch March 19, 2022 10:41
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.

2 participants