On Thu, Jul 26, 2018 at 9: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).
that's what SQLAlchemy does. if you are using raw driver-level SQL , you have to double the percent signs. but the users still complain. It is less intuitive when you are switching between SQL and DDL. > > >>> - 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? there are so many ways to make this super easy yet I still get complaints about people wanting to support some non-standard pet parameter style their driver uses (asyncpg uses $<position> or something like that). My votes remain at support ? and :name (solves your percent sign issue). > > >> - prepared statements >> >> I don't recall if I was for or against this being in the spec. >> Seems like something that should be clarified though. > > Yes! > > > -- Daniele _______________________________________________ DB-SIG maillist - DB-SIG@python.org https://mail.python.org/mailman/listinfo/db-sig