Re: [sqlalchemy] Define a GenericFunction that passes all columns

2020-04-15 Thread Mike Bayer
so the attached script includes what I was suggesting, which is that when this table or mapped class comes in, you get that into a ColumnElement right away, that way the function internals treat it like any other column; the code fails otherwise in current development SQLAlchemy versions that

Re: [sqlalchemy] Define a GenericFunction that passes all columns

2020-04-15 Thread Adrien Berchet
Yes, the first query: > select([func.ST_AsGeoJSON(Lake.__table__.c.geom)]) > returns only the geometry part of a GeoJson: { "type": "LineString", "coordinates": [[0, 0], [1, 1]] } while the query: > select([func.ST_AsGeoJSON(Lake, 'geom')]) > returns a complete GeoJson

Re: [sqlalchemy] Define a GenericFunction that passes all columns

2020-04-15 Thread Mike Bayer
working on this now, just a quick question, is there an actual difference between select([func.ST_AsGeoJSON(Lake.__table__.c.geom)]) and select([func.ST_AsGeoJSON(Lake, 'geom')]) ? that is, users definitely need this goofy "Table" syntax, right? On Wed, Apr 15, 2020, at 7:15 AM, Adrien

Re: [sqlalchemy] Define a GenericFunction that passes all columns

2020-04-15 Thread Adrien Berchet
Ok, thank you for your advice, following it I tried the following (in geoalchemy2.functions.py). class ST_AsGeoJSON(functions.GenericFunction): > > def __init__(self, *args, **kwargs): > args = list(args) > self.feature_mode = False > for idx, elem in enumerate(args):