Looking for something to mimic the replace function in an SQL statement,
like:
Select * from Clinical where replace(Clinical.string_value, ' ' , '_')
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] =
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
Hi All,
Is there anything I can do to make Query instance non-generative?
query = session.query(Foo)
query.filter(Foo.x==1)
...and have the query actually be modified rather than returning a new
query with the clause added?
cheers,
Chris
--
You received this message because you are
not through the current API, no. you'd need to write some modifier to
the @generative decorator and basically tinker with things to make it do
that.
On 12/28/2015 06:18 AM, Chris Withers wrote:
> Hi All,
>
> Is there anything I can do to make Query instance non-generative?
>
> query =
just assign to the same variable name.
query = guery.filter(Foo.x == 1)
The generative queries are a feature.
Making the queries mutable would allow functions to modify queries and
complicate debugging.
You can have functions return the modified query, or have functions return
the expressions
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
Hello all,
I need some help/ tips.
This is may be perhaps partially off tipic but still it is related to
Alchemy.
The issue is in the subject line
when I do eng = create_engine(connection_statement) I do get the engine
in eng
but when I do con = eng.connect I don't get any selection list when
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()
>
>
>
if you're using Postgresql you'd want to look into replace():
http://www.postgresql.org/docs/9.3/static/functions-string.html
e.g.
query.filter(func.replace(MyClass.column, ' ', '_') == 'some_other_value')
though if 'someothervalue' is an in-Python value and your database
doesn't have
Using MySQL. I was missing the 'func' attribute syntax for calling this in
my attempts. Works as desired.
Thanks!
Greg--
On Monday, December 28, 2015 at 9:19:22 PM UTC-6, Michael Bayer wrote:
>
> if you're using Postgresql you'd want to look into replace():
>
10 matches
Mail list logo