Michael Bayer <mike_mp <at> zzzcomputing.com> writes:
>
> sure it does, if you convert it to a SQL token first:
>
> literal("C:\test\testfile.txt").like(Table.path + "%")
>
> or even
>
> literal("C:\test\testfile.txt").startswith(Table.path)
Thanks for the quick reply!
One more quick question, how would I combine two of these like statements, if I
just use 'and' between them I get 'TypeError: Boolean value of this clause is
not defined'.
> On Nov 7, 2011, at 8:40 AM, Paul wrote:
>
> > I'm trying to do a like statement in a query filter. I'm fine doing it one
way
> > for instance
> >
> > session.query(Table).filter(Table.path.like("C:\Test\%"))
> >
> > which would hopefully return all folders and files in the folder Test
> >
> > but what if I want to do it the other way around and pass
"C:\Test\testfile.txt"
> > and return all the folders. I want something like
> > "C:\Test\testfile.txt".like(Table.path+"%") but obviously a string wont
> > have
the
> > method like.
> >
> > is there a function I can import that takes 2 arguements or another method
> > I
can
> > use to achieve this?
> >
> > Thanks!
> >
> > Paul
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
> > To post to this group, send email to sqlalchemy <at> googlegroups.com.
> > To unsubscribe from this group, send email to sqlalchemy+unsubscribe <at>
googlegroups.com.
> > For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.
> >
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.