In SQLAlchemy CORE is there any way to use bindparam() to late-bind the
type_ parameter of the func.cast function instead of a column?
I wrote a function returning a "baked query", that extracts settings stored
in a XML column. I want the extracted value to be cast to a type depending
on the specific extracted value (it depends on the xpath bound parameter).
Maybe there is to @compile something to allow bindparam() to return a type
instead of a column element...
def bake_extract_settings_query(self):
return (
select([
func.cast(
func.cast(
func.xpath(
func.cast(
bindparam("xpath"),
Text),
func.cast(adm_preference.c.data, XMLType),
type_=ARRAY(XMLType))[1],
Text),
bindparam("output_type") # <---- the problem
).label("preference")
])
.where(adm_preference.c.code == "_mainpref_")
.limit(1))
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/2d74bba4-5c3c-4133-b643-7f5d64335528%40googlegroups.com.