[DB-SIG] checking column types from cursor object in a database-independent way?

Vernon D. Cole vernondcole at gmail.com
Thu May 2 14:33:43 CEST 2013


I think that "database" as the property identifier carries too much baggage
-- there are too many meanings of, and too much use of the term, therefore
it is not immediately obvious what the property might be used for. It reads
well, but does not have an "ahha!" factor.

connection.dbapi does.   I think it would be a good choice.  +1
--
 Vernon Cole


On Thu, May 2, 2013 at 6:16 AM, M.-A. Lemburg <mal at egenix.com> wrote:

> On 23.04.2013 16:41, Michael Bayer wrote:
> >
> > On Apr 23, 2013, at 3:29 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> >
> >>
> >>
> >> A method doing the lookup via the sys.modules dictionary
> >> could resolve those issues:
> >>
> >> database = connection.database()
> >> try:
> >>    cursor = connection.cursor()
> >>    cursor.execute(...)
> >> except database.DataError:
> >>    ...
> >>
> >> Thoughts ?
> >
> >
> > we probably want to call it "module" or "namespace" or "api" or
> something like that.   The method itself can be a Python @property which
> would cause it to behave like an attribute in any case, or if we want to
> keep it as a method call to make it clear that code is being executed,
> that's fine as well.    But the spec would need to say in either case,
> "don't assign the module itself to the connection".
>
> I like the idea with a property. I'm not sure about those other name
> candidates, though: "connection.database" make the code very
> readable, IMO.
>
> Is there a possible name clash with existing attributes on database
> modules that we would need to take into account ?
>
> Another readable candidate would be "connection.dbapi".
>
> --
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Source  (#1, May 02 2013)
> >>> Python Projects, Consulting and Support ...   http://www.egenix.com/
> >>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
> >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
> ________________________________________________________________________
> 2013-04-30: Released eGenix PyRun 1.2.0 ...       http://egenix.com/go44
>
> ::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
>
>    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>            Registered at Amtsgericht Duesseldorf: HRB 46611
>                http://www.egenix.com/company/contact/
> _______________________________________________
> DB-SIG maillist  -  DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/db-sig/attachments/20130502/073ba6e5/attachment.html>


More information about the DB-SIG mailing list