On Thu, Jul 26, 2018 at 6:45 AM, Daniele Varrazzo <daniele.varra...@gmail.com> wrote: > On Thu, Jul 26, 2018 at 2:18 PM, Mike Bayer <mike...@zzzcomputing.com> wrote: > > Oh hi! If there is someone who has experience in how much effort it > takes to beat every different driver into submission that's you :) > > >>> - should execute(query) with no param go for a round of placeholders >>> escape on the string as it would execute(query, {})? > >> I think I know what issue you're talking about. This seems much >> more subtle of an issue than we would normally see in a pep-249 which >> is overall very terse about each point. > > Still a baffling thing... > > - HAL, retrieve the even records please. > > - cursor.execute("select * from students where id % 2 = 0") > > - Now please retrieve only the ones born after the date D. > > - cursor.execute("select * from students where id % 2 = 0 and dob >= %s", [D]) > > (some mysterious traceback) > > - Open the pod bay doors, HAL. > > I'd rather force people to specify % as %% regardless of the presence > of parameters (in the case of other driver the problem would be with > other characters - question marks, colons... - but it's probably the > same). > > >>> - placeholders style, of course... >> >> one positional and one named and that's it ....Annnnndddd: > > Maybe it's easy enough to use the most generic one ("%s" and > "%(name)s"? "{}" and "{name}"?) and provide a conversion library to > help implementing drivers using whatever different format they have to > use? >
This might be one of the only places where I think Oracle has made a more robust and programmer-friendly design decision than Postgres. The :param syntax of Oracle is good because it can't be confused with valid SQL or PL/SQL syntax in the absence of query parameters. Thanks, Dan _______________________________________________ DB-SIG maillist - DB-SIG@python.org https://mail.python.org/mailman/listinfo/db-sig