[DB-SIG] executemany

M.-A. Lemburg mal@lemburg.com
Mon, 28 Feb 2000 10:03:03 +0100


Michael Guidry wrote:
> 
> I'm new at python but like what I see.
> Just starting to devour M. Hammonds new book Programming on Win32 - fairly
> good read so far. Running on NT using MS SQL database.
> I think I've installed the mxODBC and mxDateTime code correctly and renamed
> the original odbc.pyd. I try to cursor.executemany but get AttributeError:
> executemany. Here's the codesnip. Any other WIN32 MS SQL folks out there
> with some hints. Thanks in advance.
> 
>  import ODBC.Windows
>  conn = ODBC.Windows.Connect('Music')
>  crsr = conn.cursor()
>  stmt = "INSERT INTO Country (name1, name2) VALUES (?,?)"
>  crsr.executemany(stmt,
>         ('Tom','Jones')
>         ('George','Smith')
>         ]
>         )
> 
> Traceback (innermost last):
>   File "<interactive input>", line 2, in ?
> AttributeError: executemany

.executemany() is not yet supported by mxODBC. You can use
.execute() with the same arguments though -- DB API 1.0
defines more or less the same semantics for .execute()
and .executemany() and mxODBC still supports most of the
DB API 1.0 features.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/