ColumnElement
is a class within the sqlalchemy.sql.elements
module of the SQLAlchemy project.
Label
is another callable from the sqlalchemy.sql.elements
package with code examples.
GeoAlchemy2 (project documentation and PyPI package information) extends SQLAlchemy with new data types for working with geospatial databases, particularly PostGIS, which is a spatial database extender for PostgreSQL. The project is provided as open source under the MIT license.
GeoAlchemy2 / geoalchemy2 / functions.py
# functions.py
import re
from sqlalchemy import inspect
from sqlalchemy.sql import functions
from sqlalchemy.sql.elements import ColumnElement
from sqlalchemy.ext.compiler import compiles
from . import types
from . import elements
class TableRowElement(ColumnElement):
def __init__(self, selectable):
self.selectable = selectable
@property
def _from_objects(self):
return [self.selectable]
class ST_AsGeoJSON(functions.GenericFunction):
name = "ST_AsGeoJSON"
def __init__(self, *args, **kwargs):
expr = kwargs.pop('expr', None)
args = list(args)
if expr is not None:
args = [expr] + args
for idx, element in enumerate(args):
if isinstance(element, functions.Function):
continue
elif isinstance(element, elements.HasFunction):
if element.extended:
func_name = element.geom_from_extended_version
func_args = [element.data]
## ... source file continues with no further ColumnElement examples...