the double colon does not appear to be necessarily a "separator" but various forum posts and whatnot seem to suggest it is some kind of namespace qualifier, it seems to be referred towards heavily in SQL Server 2000 and was somehow changed in 2005, but for this particular extension their current documentation is still referring towards it.
in the official docs for 2019 we see it called the "scope resolution operator":
it's not really clear how this should be implemented in SQLAlchemy, as I'm not really sure "double colon" outright replaces the dot for function namespace qualifiers.
If SQL Server can tolerate whitespace between the :: and the name, this recipe will work for now:
from sqlalchemy.sql.expression import UnaryExpression
from sqlalchemy.sql import operators
from sqlalchemy import func
def geometry(fn):
return UnaryExpression(fn, operator=operators.custom_op("geometry::"))
expr = geometry(func.STGeomFromText())
print(expr)
generates:
geometry:: STGeomFromText()
if not then we need to build some custom @compiles for that right now.
longer term I think we either need a new namespace added to the SQL Server dialect or we need additional options on the func. namespace to simulate this effect.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.