split problem if the delimiter is inside the text limiter

M.-A. Lemburg mal at egenix.com
Thu Mar 19 12:43:35 CET 2009


On 2009-03-19 00:30, Tim Chase wrote:
> Bruno Desthuilliers wrote:
>> Tim Chase a écrit :
>>> (if your columns in your CSV happen to match the order of your INSERT
>>> statement, you can just use
>>>
>>>   execute(sql, tuple(row))
>>
>> Or more simply:
>>
>>      cursor.execute(sql, row)
> 
> that's always annoyed me with the mxODBC drivers I've used....they
> require(d?) a tuple in this position, so I developed  this habit.  I
> think the OP hinted they were using postgres drivers which may be a bit
> kinder to the user.

This requirement in mxODBC results from still providing a DB-API 1.0
compatible interface... after all, it's been around since 1997.
Back in the early days, there was only cursor.execute() and the only way
to differentiate between a list of rows and a single row was by type.

DB-API 2.0 has cursor.executemany() to make this differentiation
at the API level. mxODBC will lift this requirement in the next
version, promised :-)

> (and don't get me started on mxODBC's failure to
> determine the data-type for parameters in subqueries, raising exceptions
> on perfectly valid queries</rant>)

I'm not sure what you are referring to here. mxODBC can only provide
an interface to the underlying ODBC driver.

If the ODBC driver does not provide the required information or
reports errors in situations where you don't expect them, mxODBC
can try to work around these things (and does for quite a few drivers),
but of course, we cannot cover all possible cases, since there are
far too many ODBC drivers out there, each with their own release
cycles.

That said, we are always open to reports about such issues so
we can work them into mxODBC updates where possible.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Mar 19 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new 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/



More information about the Python-list mailing list