Looking for something like: Select * from Clinical where replace(Clinical.string_value, ' ', '_') = 'value_here'
On Monday, December 28, 2015 at 1:16:36 PM UTC-6, Horcle wrote: > > Or something along the lines of > > Clinical.string_value.replace(' ', '_').op... > > > > On Monday, December 28, 2015 at 11:49:38 AM UTC-6, Horcle wrote: >> >> I am iteratively building a complex query. For one step, I have >> >> a[i] = a[i].filter(Clinical.string_value.op('=')([value[i]])).subquery() >> >> >> I would like to simply just replace the value in Clinical.string value >> such that all spaces are turned into underscores. My naive approach is to >> do this as >> >> replace(Clinical.string_value, ' ', '_'), but I know the syntax is >> invalid in this context. How do I plug this into my SQLAlch statement? I >> found the replace method here: >> http://docs.sqlalchemy.org/en/latest/core/sqlelement.html#sqlalchemy.sql.expression.func, >> >> but it does not seem to fit my use case. >> >> Thanks in advance! >> >> Greg-- >> > -- 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.