I know this discussion is 6 years old, but does SQLA now have support for ESCAPE clauses in SQLite LIKE queries? Is there some way I can achieve this?
Thanks, Joel On Wednesday, April 4, 2007 10:43:56 AM UTC-7, Paul Kippes wrote: > > I've been using sqlite and as far as I know, it requires the ESCAPE clause. > > I'll take a stab at creating a patch this evening. > > > On 4/4/07, Michael Bayer <mik...@zzzcomputing.com <javascript:>> wrote: > > > > in postgres for example, "\" is already the escape character, so you > > wouldnt need to say ESCAPE '\'. is this not the case in DB2 (we dont > > support DB2 anyway yet ?) ? > > > > if you want to provide a patch, this would be a keyword argument to > > the like() function, and would probably involve replacing the > > BooleanExpression that uses "like" as a regular operator with its own > > construct, i.e. sqlalchemy.sql._LikeClause. then an explicit > > visit_like() would be added to ansisql.py to process the construct as > > well as the optional "escapes" keyword argument. > > > > otherwise, please add a new enhancement ticket to trac (via the > > "bugs" link on the site) and we'll get it in the queue. > > > > > > On Apr 4, 2007, at 12:34 PM, Paul Kippes wrote: > > > > > > > > It permits escaping of the wild LIKE characters _ and %. > > > > > > Say, for example, I have this column data: > > > 1 larry_one > > > 2 larry_two > > > 3 larrysmall > > > 4 larrybig > > > 5 larry_small > > > 6 larry_big > > > > > > SELECT my_name FROM names WHERE my_name LIKE 'larry_%' > > > > > > would return all the rows; but using > > > > > > SELECT my_name FROM names WHERE my_name LIKE 'larry\_%' ESCAPE '\' > > > > > > see: http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp? > > > topic=/com.ibm.db2.udb.admin.doc/doc/r0000751.htm > > > > > > would return not return rows 3 and 4 > > > > > > On 4/4/07, Michael Bayer <mik...@zzzcomputing.com <javascript:>> > wrote: > > >> > > >> what is ESCAPE used for exactly (i.e. whats it going to do to that > > >> \ ?) ? what DB is this ? can this same functionality be achieved via > > >> bind parameters ? > > >> > > >> > > >> On Apr 4, 2007, at 10:30 AM, Paul Kippes wrote: > > >> > > >>> > > >>> Currently sqlalchemy doesn't support a query like this: > > >>> > > >>> SELECT my_name FROM names WHERE my_name LIKE 'larry\_%' ESCAPE '\' > > >>> > > >>> Could such a feature be added to be used in a similar way to the > > >>> LIMIT > > >>> feature? It looks like a simple enough patch for me to do. But I > > >>> don't have knowledge of the array of databases necessary. > > >>> > > >>> 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@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.