From dgol461 at ECY.WA.GOV Mon Oct 4 04:25:45 2010 From: dgol461 at ECY.WA.GOV (Goldsmith, David) Date: Sun, 3 Oct 2010 19:25:45 -0700 Subject: [DB-SIG] Cookbook for Python access to Access? Message-ID: Hi! I'm relatively new to DB's, though not to Python. I simply need to learn how to programmatically put data--obtained using a Python script--into an existing Access DB. I've searched and I've searched, found a few brief examples of how to connect--using, e.g., sqlite3--but when I execute a query, I'm told the file I've connected to is either encrypted or not a DB; it may be the former (I don't know how to tell for certain, but I can access it using MATLAB's database toolbox w/out any explicit decryption), but it definitely is a DB. Can anyone refer me to a relevant cookbook or pretty complete example set? Thanks! -------------------------------------- David Goldsmith Washington State Department of Ecology Environmental Assessment Program Modeling and Information Support Unit 300 Desmond Drive | P.O. Box 47600 Lacey, WA 98503 | Olympia, WA 98504-7600 Tel: (360) 407-6194 Fax: (360) 407-6884 Email: david.goldsmith at ecy.wa.gov Station: C2D-59 Web: http://www.ecy.wa.gov/programs/eap/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From shuying at gmail.com Mon Oct 4 14:32:13 2010 From: shuying at gmail.com (Shuying Wang) Date: Mon, 4 Oct 2010 23:32:13 +1100 Subject: [DB-SIG] Cookbook for Python access to Access? In-Reply-To: References: Message-ID: David, Have you tried these: http://bytes.com/topic/python/answers/637384-python-microsoft-access http://mail.python.org/pipermail/python-win32/2006-March/004420.html http://en.wikibooks.org/wiki/Python_Programming/Database_Programming Shuying On Mon, Oct 4, 2010 at 1:25 PM, Goldsmith, David wrote: > Hi! I?m relatively new to DB?s, though not to Python. I simply need to > learn how to programmatically put data--obtained using a Python script--into > an existing Access DB. I?ve searched and I?ve searched, found a few brief > examples of how to connect--using, e.g., sqlite3--but when I execute a > query, I?m told the file I?ve connected to is either encrypted or not a DB; > it may be the former (I don?t know how to tell for certain, but I can access > it using MATLAB?s database toolbox w/out any explicit decryption), but it > definitely is a DB. Can anyone refer me to a relevant cookbook or pretty > complete example set? Thanks! > > > > -------------------------------------- > David Goldsmith > Washington State Department of Ecology > Environmental Assessment Program > Modeling and Information Support Unit > 300 Desmond Drive | P.O. Box 47600 > Lacey, WA 98503 | Olympia, WA 98504-7600 > Tel: (360) 407-6194 > Fax: (360) 407-6884 > Email: david.goldsmith at ecy.wa.gov > Station: C2D-59 > Web: http://www.ecy.wa.gov/programs/eap/ > > > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carl at personnelware.com Mon Oct 4 15:52:34 2010 From: carl at personnelware.com (Carl Karsten) Date: Mon, 4 Oct 2010 08:52:34 -0500 Subject: [DB-SIG] Cookbook for Python access to Access? In-Reply-To: References: Message-ID: On Sun, Oct 3, 2010 at 9:25 PM, Goldsmith, David wrote: > Hi!? I?m relatively new to DB?s, though not to Python.? I simply need to > learn how to programmatically put data--obtained using a Python script--into > an existing Access DB.? I?ve searched and I?ve searched, found a few brief > examples of how to connect--using, e.g., sqlite3--but when I execute a > query, I?m told the file I?ve connected to is either encrypted or not a DB; Sounds like the error should read "not an sqlite db" I am guessing you are trying to use the sqlite3 code to write to an Access db. Is there an access app that still needs to use the db? If not, then you can create an sqlite db. -- Carl K From dgol461 at ECY.WA.GOV Wed Oct 6 20:40:36 2010 From: dgol461 at ECY.WA.GOV (Goldsmith, David) Date: Wed, 6 Oct 2010 11:40:36 -0700 Subject: [DB-SIG] pyodbc: help interpreting help Message-ID: Hi! Probably 'cause I'm new to DBs, I'm having trouble understanding pyodbc's help. For example, what kind of Python object is a "results set"? In particular, the syntax portion of the docstring for the tables method of a cursor object states that it returns self, but the text portion of the docstring says it "creates a results set of tables defined in the data source." It goes on to say that "each row fetched has the following columns: ...2) table_name: The table name..." It is simply a Python list of these that I want, but the API for actually returning such is far from clear: how does one access the collection of "fetched rows" (what kind of Python object is the collection and what is its name in the local dictionary) and how does one "slice out" one or more columns from it? Please help. Thanks! -------------------------------------- David Goldsmith Washington State Department of Ecology Environmental Assessment Program Modeling and Information Support Unit 300 Desmond Drive | P.O. Box 47600 Lacey, WA 98503 | Olympia, WA 98504-7600 Tel: (360) 407-6194 Fax: (360) 407-6884 Email: david.goldsmith at ecy.wa.gov Station: C2D-59 Web: http://www.ecy.wa.gov/programs/eap/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From carl at personnelware.com Thu Oct 7 03:04:25 2010 From: carl at personnelware.com (Carl Karsten) Date: Wed, 6 Oct 2010 20:04:25 -0500 Subject: [DB-SIG] pyodbc: help interpreting help In-Reply-To: References: Message-ID: On Wed, Oct 6, 2010 at 1:40 PM, Goldsmith, David wrote: > Hi!? Probably ?cause I?m new to DBs, I?m having trouble understanding > pyodbc?s help.? For example, what kind of Python object is a ?results set?? > In particular, the syntax portion of the docstring for the tables method of > a cursor object states that it returns self, but the text portion of the > docstring says it ?creates a results set of tables defined in the data > source.?? It goes on to say that ?each row fetched has the following > columns: ?2) table_name: The table name??? It is simply a Python list of > these that I want, but the API for actually returning such is far from > clear: how does one access the collection of ?fetched rows? (what kind of > Python object is the collection and what is its name in the local > dictionary) and how does one ?slice out? one or more columns from it? > Please help.? Thanks! > The odbc module that comes with python isn't very good. There are a handful of additional ones you can pick from. Here is a rundown I made afew years ago: http://wiki.python.org/moin/ODBC -- Carl K From chris at chriscurvey.com Thu Oct 7 03:19:28 2010 From: chris at chriscurvey.com (Chris Curvey) Date: Wed, 6 Oct 2010 21:19:28 -0400 Subject: [DB-SIG] pyodbc: help interpreting help In-Reply-To: References: Message-ID: Maybe a quick example would help. # connection strings vary, see www.connectionstrings.com for an example for your database connection = pyodbc.connect("your-connection-string-here") # grab a cursor from the connection (you can have multiple cursors from a connection) cursor = connection.cursor() # assumes you have a table called 'addreses' with three columns cursor.execute("select name, city, state from addresses") # fetchall() returns a list (tuple?) of tuples. So it would look like # ( ( "Bill", "Redmond", "WA), # ( "Steve", "Cupertino", "CA"), # ("Barack", "Washington", "DC") #) # gotta handle all the fetched stuff for (name, city, state) in cursor.fetchall(): # just print the name and state print name, state Does that help? On Wed, Oct 6, 2010 at 2:40 PM, Goldsmith, David wrote: > Hi! Probably ?cause I?m new to DBs, I?m having trouble understanding > pyodbc?s help. For example, what kind of Python object is a ?results set?? > In particular, the syntax portion of the docstring for the tables method of > a cursor object states that it returns self, but the text portion of the > docstring says it ?creates a results set of tables defined in the data > source.? It goes on to say that ?each row fetched has the following > columns: ?2) table_name: The table name?? It is simply a Python list of > these that I want, but the API for actually returning such is far from > clear: how does one access the collection of ?fetched rows? (what kind of > Python object is the collection and what is its name in the local > dictionary) and how does one ?slice out? one or more columns from it? > Please help. Thanks! > > > > -------------------------------------- > David Goldsmith > Washington State Department of Ecology > Environmental Assessment Program > Modeling and Information Support Unit > 300 Desmond Drive | P.O. Box 47600 > Lacey, WA 98503 | Olympia, WA 98504-7600 > Tel: (360) 407-6194 > Fax: (360) 407-6884 > Email: david.goldsmith at ecy.wa.gov > Station: C2D-59 > Web: http://www.ecy.wa.gov/programs/eap/ > > > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > > -- Ignoring that little voice in my head since 1966! -------------- next part -------------- An HTML attachment was scrubbed... URL: From mal at egenix.com Thu Oct 7 11:13:07 2010 From: mal at egenix.com (M.-A. Lemburg) Date: Thu, 07 Oct 2010 11:13:07 +0200 Subject: [DB-SIG] pyodbc: help interpreting help In-Reply-To: References: Message-ID: <4CAD8F23.7070302@egenix.com> Goldsmith, David wrote: > Hi! Probably 'cause I'm new to DBs, I'm having trouble understanding > pyodbc's help. For example, what kind of Python object is a "results > set"? In particular, the syntax portion of the docstring for the tables > method of a cursor object states that it returns self, but the text > portion of the docstring says it "creates a results set of tables > defined in the data source." It goes on to say that "each row fetched > has the following columns: ...2) table_name: The table name..." It is > simply a Python list of these that I want, but the API for actually > returning such is far from clear: how does one access the collection of > "fetched rows" (what kind of Python object is the collection and what is > its name in the local dictionary) and how does one "slice out" one or > more columns from it? Please help. Thanks! Not sure whether that's an option, but you could try our mxODBC which uses standard tuples, lists, etc.: http://www.egenix.com/products/python/mxODBC/ Here's the documentation: http://www.egenix.com/products/python/mxODBC/mxODBC.pdf or for online reading (but not as nicely formatted): http://www.egenix.com/products/python/mxODBC/doc/ -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Oct 07 2010) >>> 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/ From vernondcole at gmail.com Thu Oct 7 19:44:19 2010 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 7 Oct 2010 11:44:19 -0600 Subject: [DB-SIG] Cookbook for Python access to Access? In-Reply-To: References: Message-ID: please pardon slowness, brevity & typos ... am on vacation & using Windows Mobile... step 1) load pywin32 from sourceforge. step 2) look in your Python site-packages/adodbapi/test folder for example. You can read or update ACCESS db using normal SQL statements and Python api calls. On 10/3/10, Goldsmith, David wrote: > Hi! I'm relatively new to DB's, though not to Python. I simply need to > learn how to programmatically put data--obtained using a Python > script--into an existing Access DB. I've searched and I've searched, > found a few brief examples of how to connect--using, e.g., sqlite3--but > when I execute a query, I'm told the file I've connected to is either > encrypted or not a DB; it may be the former (I don't know how to tell > for certain, but I can access it using MATLAB's database toolbox w/out > any explicit decryption), but it definitely is a DB. Can anyone refer > me to a relevant cookbook or pretty complete example set? Thanks! > > > > -------------------------------------- > David Goldsmith > Washington State Department of Ecology > Environmental Assessment Program > Modeling and Information Support Unit > 300 Desmond Drive | P.O. Box 47600 > Lacey, WA 98503 | Olympia, WA 98504-7600 > Tel: (360) 407-6194 > Fax: (360) 407-6884 > Email: david.goldsmith at ecy.wa.gov > Station: C2D-59 > Web: http://www.ecy.wa.gov/programs/eap/ > > > > > From jd at commandprompt.com Thu Oct 7 22:43:15 2010 From: jd at commandprompt.com (Joshua D. Drake) Date: Thu, 07 Oct 2010 13:43:15 -0700 Subject: [DB-SIG] Cookbook for Python access to Access? In-Reply-To: References: Message-ID: <1286484195.10306.32.camel@jd-desktop> On Thu, 2010-10-07 at 11:44 -0600, Vernon Cole wrote: > please pardon slowness, brevity & typos ... am on vacation & using > Windows Mobile... That is no way to spend a vacation. -- PostgreSQL.org Major Contributor Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579 Consulting, Training, Support, Custom Development, Engineering http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt From dgol461 at ECY.WA.GOV Thu Oct 7 17:19:26 2010 From: dgol461 at ECY.WA.GOV (Goldsmith, David) Date: Thu, 7 Oct 2010 08:19:26 -0700 Subject: [DB-SIG] pyodbc: help interpreting help In-Reply-To: <4CAD8F23.7070302@egenix.com> References: <4CAD8F23.7070302@egenix.com> Message-ID: Thanks, Marc-Andre. That sounds interesting; unfortunately, I don't have any money to spend. :-( DG -----Original Message----- From: M.-A. Lemburg [mailto:mal at egenix.com] Sent: Thursday, October 07, 2010 2:13 AM To: Goldsmith, David Cc: db-sig at python.org Subject: Re: [DB-SIG] pyodbc: help interpreting help Goldsmith, David wrote: > Hi! Probably 'cause I'm new to DBs, I'm having trouble understanding > pyodbc's help. For example, what kind of Python object is a "results > set"? In particular, the syntax portion of the docstring for the tables > method of a cursor object states that it returns self, but the text > portion of the docstring says it "creates a results set of tables > defined in the data source." It goes on to say that "each row fetched > has the following columns: ...2) table_name: The table name..." It is > simply a Python list of these that I want, but the API for actually > returning such is far from clear: how does one access the collection of > "fetched rows" (what kind of Python object is the collection and what is > its name in the local dictionary) and how does one "slice out" one or > more columns from it? Please help. Thanks! Not sure whether that's an option, but you could try our mxODBC which uses standard tuples, lists, etc.: http://www.egenix.com/products/python/mxODBC/ Here's the documentation: http://www.egenix.com/products/python/mxODBC/mxODBC.pdf or for online reading (but not as nicely formatted): http://www.egenix.com/products/python/mxODBC/doc/ -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Oct 07 2010) >>> 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/ From dgol461 at ECY.WA.GOV Thu Oct 7 21:57:48 2010 From: dgol461 at ECY.WA.GOV (Goldsmith, David) Date: Thu, 7 Oct 2010 12:57:48 -0700 Subject: [DB-SIG] Cookbook for Python access to Access? In-Reply-To: References: Message-ID: Thanks, Vernon. I did as you suggest, including visiting http://www.python.org/dev/peps/pep-0249/ I still don't see how to return a list of tables available in the DB one has connected to. I can't believe no one has ever needed to do this, yet all the replies I'm getting/examples I'm being referred to/methods I read about would seem to indicate that such an operation is generally not supported by the DB model--is that correct? DG -----Original Message----- From: Vernon Cole [mailto:vernondcole at gmail.com] Sent: Thursday, October 07, 2010 10:44 AM To: Goldsmith, David; DB-SIG @ Python.org Subject: Re: [DB-SIG] Cookbook for Python access to Access? please pardon slowness, brevity & typos ... am on vacation & using Windows Mobile... step 1) load pywin32 from sourceforge. step 2) look in your Python site-packages/adodbapi/test folder for example. You can read or update ACCESS db using normal SQL statements and Python api calls. On 10/3/10, Goldsmith, David wrote: > Hi! I'm relatively new to DB's, though not to Python. I simply need to > learn how to programmatically put data--obtained using a Python > script--into an existing Access DB. I've searched and I've searched, > found a few brief examples of how to connect--using, e.g., sqlite3--but > when I execute a query, I'm told the file I've connected to is either > encrypted or not a DB; it may be the former (I don't know how to tell > for certain, but I can access it using MATLAB's database toolbox w/out > any explicit decryption), but it definitely is a DB. Can anyone refer > me to a relevant cookbook or pretty complete example set? Thanks! > > > > -------------------------------------- > David Goldsmith > Washington State Department of Ecology > Environmental Assessment Program > Modeling and Information Support Unit > 300 Desmond Drive | P.O. Box 47600 > Lacey, WA 98503 | Olympia, WA 98504-7600 > Tel: (360) 407-6194 > Fax: (360) 407-6884 > Email: david.goldsmith at ecy.wa.gov > Station: C2D-59 > Web: http://www.ecy.wa.gov/programs/eap/ > > > > > From dgol461 at ECY.WA.GOV Thu Oct 7 22:26:19 2010 From: dgol461 at ECY.WA.GOV (Goldsmith, David) Date: Thu, 7 Oct 2010 13:26:19 -0700 Subject: [DB-SIG] Cookbook for Python access to Access? In-Reply-To: References: Message-ID: Ala James Briggs' post (attached), is there a way in adodbapi to leverage the fact that I have a UserDSN defined for my DB? DG -----Original Message----- From: Vernon Cole [mailto:vernondcole at gmail.com] Sent: Thursday, October 07, 2010 10:44 AM To: Goldsmith, David; DB-SIG @ Python.org Subject: Re: [DB-SIG] Cookbook for Python access to Access? please pardon slowness, brevity & typos ... am on vacation & using Windows Mobile... step 1) load pywin32 from sourceforge. step 2) look in your Python site-packages/adodbapi/test folder for example. You can read or update ACCESS db using normal SQL statements and Python api calls. On 10/3/10, Goldsmith, David wrote: > Hi! I'm relatively new to DB's, though not to Python. I simply need to > learn how to programmatically put data--obtained using a Python > script--into an existing Access DB. I've searched and I've searched, > found a few brief examples of how to connect--using, e.g., sqlite3--but > when I execute a query, I'm told the file I've connected to is either > encrypted or not a DB; it may be the former (I don't know how to tell > for certain, but I can access it using MATLAB's database toolbox w/out > any explicit decryption), but it definitely is a DB. Can anyone refer > me to a relevant cookbook or pretty complete example set? Thanks! > > > > -------------------------------------- > David Goldsmith > Washington State Department of Ecology > Environmental Assessment Program > Modeling and Information Support Unit > 300 Desmond Drive | P.O. Box 47600 > Lacey, WA 98503 | Olympia, WA 98504-7600 > Tel: (360) 407-6194 > Fax: (360) 407-6884 > Email: david.goldsmith at ecy.wa.gov > Station: C2D-59 > Web: http://www.ecy.wa.gov/programs/eap/ > > > > > -------------- next part -------------- An embedded message was scrubbed... From: "James Briggs" Subject: Re: [DB-SIG] Cookbook for Python access to Access? Date: Tue, 5 Oct 2010 15:30:10 -0700 Size: 3727 URL: From vsrivastav at gmail.com Fri Oct 8 18:30:34 2010 From: vsrivastav at gmail.com (Vivek Srivastav) Date: Fri, 8 Oct 2010 12:30:34 -0400 Subject: [DB-SIG] Error in compiling InformixDB Message-ID: Hi Carsten, I know it's been a while since any development was done on InformixDB, however I wanted to see if you would have any idea on how to resolve. I would appreciate any pointers or help. Sincere Regards, Vivek I am trying to compile the InformixDB on mac platform and am getting the following warnings: vivsrivas-MacBook-Pro:InformixDB-2.5 vivsriva$ python setup.py build_ext running build_ext /Applications/IBM/informix/bin/esql -EDHAVE_ESQL9 -EDHAVE_DESCRIBE_INPUT -e _informixdb.ec building '_informixdb' extension gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DPYTHON_INCLUDE=/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -DHAVE_C_DATETIME=1 -DHAVE_PY_BOOL=1 -Iext -I/Applications/IBM/informix/incl/esql -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c ext/_informixdb.c -o build/temp.macosx-10.6-universal-2.6/ext/_informixdb.o _informixdb.ec: In function ?dberror_value?: _informixdb.ec:3385: warning: the address of ?message? will always evaluate as ?true? _informixdb.ec: In function ?Sblob_init?: _informixdb.ec:3808: warning: value computed is not used _informixdb.ec:3813: warning: value computed is not used _informixdb.ec:3819: warning: value computed is not used _informixdb.ec:3825: warning: value computed is not used _informixdb.ec:3835: warning: value computed is not used _informixdb.ec:3845: warning: value computed is not used _informixdb.ec:3851: warning: value computed is not used _informixdb.ec:3857: warning: value computed is not used _informixdb.ec: In function ?dberror_value?: _informixdb.ec:3385: warning: the address of ?message? will always evaluate as ?true? _informixdb.ec: In function ?Sblob_init?: _informixdb.ec:3808: warning: value computed is not used _informixdb.ec:3813: warning: value computed is not used _informixdb.ec:3819: warning: value computed is not used _informixdb.ec:3825: warning: value computed is not used _informixdb.ec:3835: warning: value computed is not used _informixdb.ec:3845: warning: value computed is not used _informixdb.ec:3851: warning: value computed is not used _informixdb.ec:3857: warning: value computed is not used _informixdb.ec: In function ?get_bool_from_int?: _informixdb.ec:125: warning: cast from pointer to integer of different size _informixdb.ec: In function ?set_bool_to_int?: _informixdb.ec:139: warning: cast from pointer to integer of different size _informixdb.ec: In function ?dberror_value?: _informixdb.ec:3385: warning: the address of ?message? will always evaluate as ?true? _informixdb.ec: In function ?Sblob_init?: _informixdb.ec:3808: warning: value computed is not used _informixdb.ec:3813: warning: value computed is not used _informixdb.ec:3819: warning: value computed is not used _informixdb.ec:3825: warning: value computed is not used _informixdb.ec:3835: warning: value computed is not used _informixdb.ec:3845: warning: value computed is not used _informixdb.ec:3851: warning: value computed is not used _informixdb.ec:3857: warning: value computed is not used _informixdb.ec: In function ?Sblob_specget?: _informixdb.ec:4129: warning: cast from pointer to integer of different size _informixdb.ec:4160: warning: cast from pointer to integer of different size gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc -arch x86_64 build/temp.macosx-10.6-universal-2.6/ext/_informixdb.o -framework DirectoryService /Applications/IBM/informix/lib/esql/checkapi.o -L/Applications/IBM/informix/lib/esql -L/Applications/IBM/informix/lib -lifsql -lifasf -lifgen -lifos -lifgls -lifglx -o build/lib.macosx-10.6-universal-2.6/_informixdb.so ld: warning: in /Applications/IBM/informix/lib/esql/checkapi.o, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /Applications/IBM/informix/lib/esql/libifsql.dylib, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /Applications/IBM/informix/lib/libifasf.dylib, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /Applications/IBM/informix/lib/esql/libifgen.dylib, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /Applications/IBM/informix/lib/esql/libifos.dylib, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /Applications/IBM/informix/lib/esql/libifgls.dylib, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /Applications/IBM/informix/lib/esql/libifglx.dylib, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /Applications/IBM/informix/lib/esql/checkapi.o, file was built for unsupported file format which is not the architecture being linked (ppc) ld: warning: in /Applications/IBM/informix/lib/esql/libifsql.dylib, file was built for unsupported file format which is not the architecture being linked (ppc) ld: warning: in /Applications/IBM/informix/lib/libifasf.dylib, file was built for unsupported file format which is not the architecture being linked (ppc) ld: warning: in /Applications/IBM/informix/lib/esql/libifgen.dylib, file was built for unsupported file format which is not the architecture being linked (ppc) ld: warning: in /Applications/IBM/informix/lib/esql/libifos.dylib, file was built for unsupported file format which is not the architecture being linked (ppc) ld: warning: in /Applications/IBM/informix/lib/esql/libifgls.dylib, file was built for unsupported file format which is not the architecture being linked (ppc) ld: warning: in /Applications/IBM/informix/lib/esql/libifglx.dylib, file was built for unsupported file format which is not the architecture being linked (ppc) Also when I run python -c "import informixdb" I get following error message: vivsrivas-MacBook-Pro:InformixDB-2.5 vivsriva$ python -c "import informixdb" Traceback (most recent call last): File "", line 1, in File "informixdb.py", line 146, in from _informixdb import * ImportError: dlopen(/Library/Python/2.6/site-packages/_informixdb.so, 2): Symbol not found: _SQLCODE Referenced from: /Library/Python/2.6/site-packages/_informixdb.so Expected in: flat namespace in /Library/Python/2.6/site-packages/_informixdb.so -------------- next part -------------- An HTML attachment was scrubbed... URL: From phd at phd.pp.ru Sun Oct 10 14:18:46 2010 From: phd at phd.pp.ru (Oleg Broytman) Date: Sun, 10 Oct 2010 16:18:46 +0400 Subject: [DB-SIG] SQLObject 0.14.0 Message-ID: <20101010121846.GC32412@phd.pp.ru> Hello! I'm pleased to announce version 0.14.0, the first stable release of branch 0.14 of SQLObject. What is SQLObject ================= SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://pypi.python.org/pypi/SQLObject/0.14.0 News and changes: http://sqlobject.org/News.html What's New ========== News since 0.13 --------------- Features & Interface ~~~~~~~~~~~~~~~~~~~~ * The lists of columns/indices/joins are now sorted according to the order of declaration. * ``validator2`` was added to all columns; it is inserted at the beginning of the list of validators, i.e. its ``from_python()`` method is called first, ``to_python()`` is called last, after all validators in the list. * SQLiteConnection's parameter ``use_table_info`` became boolean with default value True; this means the default schema parser is now based on ``PRAGMA table_info()``. * Major API change: attribute 'dirty' was moved to sqlmeta. For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From vernondcole at gmail.com Sun Oct 10 14:59:40 2010 From: vernondcole at gmail.com (Vernon Cole) Date: Sun, 10 Oct 2010 06:59:40 -0600 Subject: [DB-SIG] Cookbook for Python access to Access? In-Reply-To: References: Message-ID: I can't test this right now, but it looks like one may be able to get that information from a table called "dbf.databases". Check out the documentation in http://technet.microsoft.com/en-us/library/cc805477.aspx particularly chapter 2. I note where it says: "To get a list of the objects in a database, you iterate through each Collection object. The following example iterates through each TableDef, QueryDef, Relation, and Container object in a database, and prints the object name to the Debug window."Followed by a VB example. If you can work out how to do that retrieval in SQL you will have it. Let us know what works, if it works. -- Vernon On Thu, Oct 7, 2010 at 1:57 PM, Goldsmith, David wrote: > Thanks, Vernon. I did as you suggest, including visiting > > http://www.python.org/dev/peps/pep-0249/ > > I still don't see how to return a list of tables available in the DB one > has connected to. > > I can't believe no one has ever needed to do this, yet all the replies > I'm getting/examples I'm being referred to/methods I read about would > seem to indicate that such an operation is generally not supported by > the DB model--is that correct? > > DG > > -----Original Message----- > From: Vernon Cole [mailto:vernondcole at gmail.com] > Sent: Thursday, October 07, 2010 10:44 AM > To: Goldsmith, David; DB-SIG @ Python.org > Subject: Re: [DB-SIG] Cookbook for Python access to Access? > > please pardon slowness, brevity & typos ... am on vacation & using > Windows Mobile... > step 1) load pywin32 from sourceforge. > step 2) look in your Python site-packages/adodbapi/test folder for > example. > You can read or update ACCESS db using normal SQL statements and > Python api calls. > > On 10/3/10, Goldsmith, David wrote: > > Hi! I'm relatively new to DB's, though not to Python. I simply need > to > > learn how to programmatically put data--obtained using a Python > > script--into an existing Access DB. I've searched and I've searched, > > found a few brief examples of how to connect--using, e.g., > sqlite3--but > > when I execute a query, I'm told the file I've connected to is either > > encrypted or not a DB; it may be the former (I don't know how to tell > > for certain, but I can access it using MATLAB's database toolbox w/out > > any explicit decryption), but it definitely is a DB. Can anyone refer > > me to a relevant cookbook or pretty complete example set? Thanks! > > > > > > > > -------------------------------------- > > David Goldsmith > > Washington State Department of Ecology > > Environmental Assessment Program > > Modeling and Information Support Unit > > 300 Desmond Drive | P.O. Box 47600 > > Lacey, WA 98503 | Olympia, WA 98504-7600 > > Tel: (360) 407-6194 > > Fax: (360) 407-6884 > > Email: david.goldsmith at ecy.wa.gov > > > Station: C2D-59 > > Web: http://www.ecy.wa.gov/programs/eap/ > > > > > > > > > > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carsten.haese at gmail.com Mon Oct 11 02:49:07 2010 From: carsten.haese at gmail.com (Carsten Haese) Date: Sun, 10 Oct 2010 20:49:07 -0400 Subject: [DB-SIG] Error in compiling InformixDB In-Reply-To: References: Message-ID: On Fri, Oct 8, 2010 at 12:30 PM, Vivek Srivastav wrote: > Hi Carsten, > I know it's been a while since any development was done on InformixDB, > however I wanted to see if you would have any idea on how to resolve. I > would appreciate any pointers or help. > Sincere Regards, > Vivek > I am trying to compile the InformixDB on mac platform and am getting the > following warnings: > [snip] Hi Vivek, I wish I could offer any assistance, but I don't have any experience with the mac platform, so I wouldn't even know where to begin to troubleshoot the problem. -Carsten From mal at egenix.com Thu Oct 14 13:19:31 2010 From: mal at egenix.com (M.-A. Lemburg) Date: Thu, 14 Oct 2010 13:19:31 +0200 Subject: [DB-SIG] PEP 249 (database api) -- executemany() with iterable? In-Reply-To: References: Message-ID: <4CB6E743.1050000@egenix.com> Terry Reedy wrote: > On 10/12/2010 11:10 AM, Roy Smith wrote: >> PEP 249 says about executemany(): >> >> Prepare a database operation (query or command) and then >> execute it against all parameter sequences or mappings >> found in the sequence seq_of_parameters. >> >> are there any plans to update the api to allow an iterable instead of >> a sequence? > > That question would best be addressed to the pep author > Marc-Andr? Lemburg Questions about the DB-API should be discussed on the Python DB-SIG list (put on CC): http://mail.python.org/mailman/listinfo/db-sig Regarding your question: At the time the PEP was written, Python did not have iterables. However, even with iterables, please keep in mind that pushing the data row-per-row over a network does not result in good performance, so using an iterable will make you update slower. cursor.executemany() is meant to allow the database module to optimize sending bulk data to the database and ideally, it will send the whole sequence to the database in one go. If you want to efficiently run an update with millions of entries based on an iterable, it is better to use an intermediate loop which builds sequences of say 1000 rows and then processes those with a cursor.executemany() call. You will likely also do this in multiple transactions to prevent the database from creating a multi-GB transaction log for the upload. Another aspect to keep in mind is error reporting. When sending bulk data to a database, some databases only report "error" for the whole data block, so finding the problem can be troublesome. For that reason, using smaller blocks is better even when having the data available as real sequence. Hope that helps, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Oct 14 2010) >>> 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/ From phd at phd.pp.ru Fri Oct 15 15:17:40 2010 From: phd at phd.pp.ru (Oleg Broytman) Date: Fri, 15 Oct 2010 17:17:40 +0400 Subject: [DB-SIG] SQLObject 0.13.1 Message-ID: <20101015131740.GB14950@phd.pp.ru> Hello! I'm pleased to announce version 0.13.1, a minor bugfix release of branch 0.13 of SQLObject. What is SQLObject ================= SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://pypi.python.org/pypi/SQLObject/0.13.1 News and changes: http://sqlobject.org/News.html What's New ========== News since 0.13.0 ----------------- * A bug was fixed in a subtle case when a per-instance connection is not passed to validators. For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From phd at phd.pp.ru Fri Oct 15 15:19:28 2010 From: phd at phd.pp.ru (Oleg Broytman) Date: Fri, 15 Oct 2010 17:19:28 +0400 Subject: [DB-SIG] SQLObject 0.14.1 Message-ID: <20101015131928.GF14950@phd.pp.ru> Hello! I'm pleased to announce version 0.14.1, a minor bugfix release of branch 0.14 of SQLObject. What is SQLObject ================= SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://pypi.python.org/pypi/SQLObject/0.14.1 News and changes: http://sqlobject.org/News.html What's New ========== News since 0.14.0 ----------------- * A bug was fixed in a subtle case when a per-instance connection is not passed to validators. For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From sqlite3.user at gmail.com Sat Oct 16 09:08:14 2010 From: sqlite3.user at gmail.com (python + sqlite3) Date: Sat, 16 Oct 2010 00:08:14 -0700 (PDT) Subject: [DB-SIG] Python db programming conventions Message-ID: <29977345.post@talk.nabble.com> Hello all, As I'm new to both python and sqlite3, I would like to consult regarding python db programming conventions. After I finished to design my application and started coding it, I found myself dealing with the following questions: 1. Since the db contains more than one table, it seems natural to use transaction in order to create the it. The transaction contains more than one SQL statement and therefor can't be executed using cursor.execute(). I found the method cursor.executescript() that documented as non-standard, is that the method to be used? is there better way of creating the db? 2. In order to create and maintain the db tables, I'll need to use several long transactions (CREATE, EDIT, INSERT, DELETE etc.). Where should I place the SQL code for them? Should my class contain the SQL queries as private string properties? should I define the SQL queries as class member functions? Or is it better to store the SQL code in separate SQL files and execute the files somehow (is it possible to execute SQL file using sqlite3)? I'd appreciate your help, Cheers -- View this message in context: http://old.nabble.com/Python-db-programming-conventions-tp29977345p29977345.html Sent from the Python - db-sig mailing list archive at Nabble.com. From wilk at flibuste.net Tue Oct 19 15:57:33 2010 From: wilk at flibuste.net (William Dode) Date: Tue, 19 Oct 2010 13:57:33 +0000 (UTC) Subject: [DB-SIG] adodbapi 2.4 : not possible to pickle Message-ID: Hi, Since adodbapi 2.4 it's not more possible to pickle a recordset when there is a datetime column in the result. I've digged, it's because PyTime object are kept in _SQLRow Is there a workaround ? thanks -- William Dod? - http://flibuste.net Informaticien Ind?pendant From vernondcole at gmail.com Tue Oct 19 18:11:14 2010 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 19 Oct 2010 10:11:14 -0600 Subject: [DB-SIG] adodbapi 2.4 : not possible to pickle In-Reply-To: References: Message-ID: Hmmm... pickle was one thing I failed to consider when I changed the adodbapi .fetchxxx methods to return a sequence-like object (_SQLrow) rather than an actual tuple. Since I have never had the need to use pickle, I have never tested it. Frankly, it never occurred to me that one would ever want to serialize data which just came in from a data base. As you have noticed, data in an _SQLrow object are not converted into Python types until extracted from the object by its _getValue() method. In previous versions, the conversion was done before you received the data. The quickest workaround would be (in your code) to simply call tuple() on the returned row object before pickling it. That should give the same result as before, when tuple() was called internally. If this is something which is done frequently, then a perhaps a suitable method should be added to the class definition of _SQLrow() so that pickle would work on it directly. Is __getstate__() what one uses for this? -- Vernon On Tue, Oct 19, 2010 at 7:57 AM, William Dode wrote: > Hi, > > Since adodbapi 2.4 it's not more possible to pickle a recordset when > there is a datetime column in the result. I've digged, it's because > PyTime object are kept in _SQLRow > > Is there a workaround ? > > thanks > > -- > William Dod? - http://flibuste.net > Informaticien Ind?pendant > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Tue Oct 19 19:26:59 2010 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 19 Oct 2010 11:26:59 -0600 Subject: [DB-SIG] Python db programming conventions In-Reply-To: <29977345.post@talk.nabble.com> References: <29977345.post@talk.nabble.com> Message-ID: This answer is based on the generic db-api, not specifically on sqlite3. 1. transactions are controlled by the connection object, not the cursor object. so: import sqlite3 as db conn = db.connect('someDatabase') while someCondition: c1 = conn.cursor() c2 = conn.cursor() c1.execute('update something') c2.execute('update another thing') conn.commit() # commits both operations c1.close() c2.close() 2. Put the SQL code where ever it fits best in your application. Do remember to use parameters for changeable data, rather than string substitution in the SQL code. I find that my code is most readable when I keep the SQL near the .execute() statement, like this: def get_volunteers(rank,serviceLength=0): c = conn.cursor() # conn is a connection defined elsewhere sql = """SELECT name, serial_number from battalion where rank = ? and length_of_service > ?""" c.execute(sql,(rank,serviceLength)) for s in c.fetchall(): print(s[0],s[1]) -- Vernon On Sat, Oct 16, 2010 at 1:08 AM, python + sqlite3 wrote: > > Hello all, > > As I'm new to both python and sqlite3, I would like to consult regarding > python db programming conventions. After I finished to design my > application > and started coding it, I found myself dealing with the following questions: > > 1. Since the db contains more than one table, it seems natural to use > transaction in order to create the it. The transaction contains more than > one SQL statement and therefor can't be executed using cursor.execute(). I > found the method cursor.executescript() that documented as non-standard, is > that the method to be used? is there better way of creating the db? > > 2. In order to create and maintain the db tables, I'll need to use several > long transactions (CREATE, EDIT, INSERT, DELETE etc.). Where should I place > the SQL code for them? Should my class contain the SQL queries as private > string properties? should I define the SQL queries as class member > functions? Or is it better to store the SQL code in separate SQL files and > execute the files somehow (is it possible to execute SQL file using > sqlite3)? > > I'd appreciate your help, > Cheers > -- > View this message in context: > http://old.nabble.com/Python-db-programming-conventions-tp29977345p29977345.html > Sent from the Python - db-sig mailing list archive at Nabble.com. > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sqlite3.user at gmail.com Wed Oct 20 21:56:46 2010 From: sqlite3.user at gmail.com (python + sqlite3) Date: Wed, 20 Oct 2010 12:56:46 -0700 (PDT) Subject: [DB-SIG] Python db programming conventions Message-ID: <30007234.post@talk.nabble.com> Vernon, 10x for the detailed reply. I understand from your answer that each SQL statement should have it's own cursor so in my case, since the db contains 5 tables, creating it will require 5 cursors. The parametrized queries will become handy when I'll write the INSERT and SELECT part of the code. again, 10x for your help. -- View this message in context: http://old.nabble.com/Python-db-programming-conventions-tp29977345p30007234.html Sent from the Python - db-sig mailing list archive at Nabble.com. From mal at egenix.com Wed Oct 20 22:26:20 2010 From: mal at egenix.com (M.-A. Lemburg) Date: Wed, 20 Oct 2010 22:26:20 +0200 Subject: [DB-SIG] Python db programming conventions In-Reply-To: <30007234.post@talk.nabble.com> References: <30007234.post@talk.nabble.com> Message-ID: <4CBF506C.9020100@egenix.com> python + sqlite3 wrote: > > Vernon, 10x for the detailed reply. > > I understand from your answer that each SQL statement should have it's own > cursor so in my case, > since the db contains 5 tables, creating it will require 5 cursors. You can reuse cursors to run multiple commands. However, if you need to access the result sets of e.g. 5 different queries at the same time, then you do indeed have to open 5 cursors to keep open the result sets. > The parametrized queries will become handy when I'll write the INSERT and > SELECT part of the code. Here's a short introduction to the DB-API and the concepts: http://www.egenix.com/library/presentations/EuroPython2008-Using-the-Python-Database-API/ I also gave a slightly longer talk in German at the recent DZUG Tagung 2010 in Dresden: http://www.zope.de/tagung/Dresden_2010/Python-Datenbankprogrammierung_mal.pdf/view -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Oct 20 2010) >>> 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/ From dieter at handshake.de Thu Oct 21 08:01:26 2010 From: dieter at handshake.de (Dieter Maurer) Date: Thu, 21 Oct 2010 08:01:26 +0200 Subject: [DB-SIG] adodbapi 2.4 : not possible to pickle In-Reply-To: References: Message-ID: <19647.55094.532348.895235@gargle.gargle.HOWL> Vernon Cole wrote at 2010-10-19 10:11 -0600: > ... > If this is something which is done frequently, then a perhaps a suitable >method should be added to the class definition of _SQLrow() so that pickle >would work on it directly. Is __getstate__() what one uses for this? "__getstate__", "__setstate__" and "__new__" (and potentially "__newargs__") are used for pickling (and unpickling). -- Dieter From wilk at flibuste.net Thu Oct 21 13:34:37 2010 From: wilk at flibuste.net (William Dode) Date: Thu, 21 Oct 2010 11:34:37 +0000 (UTC) Subject: [DB-SIG] adodbapi 2.4 : not possible to pickle References: Message-ID: On 19-10-2010, Vernon Cole wrote: > --===============0015925617== > Content-Type: multipart/alternative; boundary=001485f64746fd50ce0492fa8b98 > > --001485f64746fd50ce0492fa8b98 > Content-Type: text/plain; charset=ISO-8859-1 > Content-Transfer-Encoding: quoted-printable > > Hmmm... pickle was one thing I failed to consider when I changed the > adodbapi .fetchxxx methods to return a sequence-like object (_SQLrow) rathe= > r > than an actual tuple. Since I have never had the need to use pickle, I have > never tested it. Frankly, it never occurred to me that one would ever want > to serialize data which just came in from a data base. > > As you have noticed, data in an _SQLrow object are not converted into > Python types until extracted from the object by its _getValue() method. In > previous versions, the conversion was done before you received the data. > > The quickest workaround would be (in your code) to simply call tuple() on > the returned row object before pickling it. That should give the same > result as before, when tuple() was called internally. > > If this is something which is done frequently, then a perhaps a suitable > method should be added to the class definition of _SQLrow() so that pickle > would work on it directly. Is __getstate__() what one uses for this? Thanks, i will try. I use pickle for remote task, it's very usefull. I use my own class to access the rows, like your SQLRows, maybe it could be fine to can choose to use it or not ? -- William Dod? - http://flibuste.net Informaticien Ind?pendant