From satomi.ninomiya at db.com Mon Sep 10 03:39:58 2007 From: satomi.ninomiya at db.com (Satomi Ninomiya) Date: Mon, 10 Sep 2007 10:39:58 +0900 Subject: [DB-SIG] questions for Python Database API Specification v2.0 Message-ID: Dear Sir/Madam, Nice to meet you. I have a question about Python Database API Specification v2.0. http://www.python.org/dev/peps/pep-0249/ I would like to access the database connected by ODBC and am looking for a sample code for that. If you have it, Could you kindly let me know about it, please? Thanks, satomi --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20070910/61f89c74/attachment.htm From d.v.selitsky at gmail.com Mon Sep 10 11:44:42 2007 From: d.v.selitsky at gmail.com (Dmitry Selitsky) Date: Mon, 10 Sep 2007 12:44:42 +0300 Subject: [DB-SIG] questions for Python Database API Specification v2.0 In-Reply-To: References: Message-ID: <7bef4eaf0709100244q16164114l4723fbc804074ddb@mail.gmail.com> Hello Satomi, > I have a question about Python Database API Specification v2.0. http://www.python.org/dev/peps/pep-0249/ > I would like to access the database connected by ODBC and am looking for a sample code for that. Here I've pasted some simple examples: ------------------------------------------------------------------- # -*- coding: utf-8 -*- # Windows only, http://sourceforge.net/projects/pywin32/ import odbc conn = odbc.odbc('DBALIAS') # or odbc.odbc('DBALIAS/USERNAME/PASSWORD') cur = conn.cursor() cur.execute('SELECT * FROM YOURTABLE') data = cur.fetchall() print data ############################## # http://ceodbc.sourceforge.net/ import ceODBC conn = ceODBC.connect('DSN=DBALIAS') # or ceODBC.connect ('DSN=DBALIAS;UID=USERNAME;PWD=PASSWORD') cur = conn.cursor() cur.execute('SELECT * FROM YOURTABLE') data = cur.fetchall() print data ############################## # using Egenix's commercial friver # www.egenix.com/products/python/mxODBC import mx.ODBC.Windows as odbc conn = odbc.connect('DBALIAS') # or odbc.connect('DBALIAS', 'USERNAME', 'PASSWORD') cur = conn.cursor() cur.execute('SELECT * FROM YOURTABLE') data = cur.fetchall() print data ------------------------------------------------------------------- -- Best Regards, Dmitry V. Selitsky +375 29 7724015 | ICQ 73737480 | http://wiki.python.org/moin/DmitrySelitsky -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20070910/44ae2736/attachment.htm From satomi.ninomiya at db.com Mon Sep 10 12:00:07 2007 From: satomi.ninomiya at db.com (Satomi Ninomiya) Date: Mon, 10 Sep 2007 19:00:07 +0900 Subject: [DB-SIG] questions for Python Database API Specification v2.0 In-Reply-To: <7bef4eaf0709100244q16164114l4723fbc804074ddb@mail.gmail.com> Message-ID: Hi, Dmitry Thank you for a quick response. It is really helpful for me. Thanks, satomi d.v.selitsky at gmail.com 09/10/2007 06:44 PM To Satomi Ninomiya/db/dbcom at DBAPAC cc db-sig at python.org Subject Re: [DB-SIG] questions for Python Database API Specification v2.0 Hello Satomi, > I have a question about Python Database API Specification v2.0. http://www.python.org/dev/peps/pep-0249/ > I would like to access the database connected by ODBC and am looking for a sample code for that. Here I've pasted some simple examples: ------------------------------------------------------------------- # -*- coding: utf-8 -*- # Windows only, http://sourceforge.net/projects/pywin32/ import odbc conn = odbc.odbc('DBALIAS') # or odbc.odbc('DBALIAS/USERNAME/PASSWORD') cur = conn.cursor() cur.execute('SELECT * FROM YOURTABLE') data = cur.fetchall() print data ############################## # http://ceodbc.sourceforge.net/ import ceODBC conn = ceODBC.connect('DSN=DBALIAS') # or ceODBC.connect('DSN=DBALIAS;UID=USERNAME;PWD=PASSWORD') cur = conn.cursor() cur.execute('SELECT * FROM YOURTABLE') data = cur.fetchall() print data ############################## # using Egenix's commercial friver # www.egenix.com/products/python/mxODBC import mx.ODBC.Windows as odbc conn = odbc.connect('DBALIAS') # or odbc.connect('DBALIAS', 'USERNAME', 'PASSWORD') cur = conn.cursor() cur.execute('SELECT * FROM YOURTABLE') data = cur.fetchall() print data ------------------------------------------------------------------- -- Best Regards, Dmitry V. Selitsky +375 29 7724015 | ICQ 73737480 | http://wiki.python.org/moin/DmitrySelitsky --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20070910/e58f1321/attachment.htm From wilk at flibuste.net Mon Sep 10 11:58:19 2007 From: wilk at flibuste.net (William Dode) Date: Mon, 10 Sep 2007 09:58:19 +0000 (UTC) Subject: [DB-SIG] questions for Python Database API Specification v2.0 References: Message-ID: On 10-09-2007, Satomi Ninomiya wrote: > Dear Sir/Madam, > > Nice to meet you. > I have a question about Python Database API Specification v2.0. > http://www.python.org/dev/peps/pep-0249/ > I would like to access the database connected by ODBC and am looking for a > sample code for that. > > If you have it, Could you kindly let me know about it, please? You should look at http://pyodbc.sourceforge.net/ -- William Dod? - http://flibuste.net Informaticien ind?pendant From sakesun at boonthavorn.com Tue Sep 11 08:06:06 2007 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Tue, 11 Sep 2007 13:06:06 +0700 Subject: [DB-SIG] questions for Python Database API Specification v2.0 In-Reply-To: References: Message-ID: Hi, Just curious. What's the different between pyodbc and ceodbc ? Cant the two project merged ? Given that the ODBC binary api is stable, I believe python-odbc can be based on ctypes. This way the re-compilation would no longer needed. On Mon, 10 Sep 2007 16:58:19 +0700, William Dode wrote: > On 10-09-2007, Satomi Ninomiya wrote: > >> Dear Sir/Madam, >> >> Nice to meet you. >> I have a question about Python Database API Specification v2.0. >> http://www.python.org/dev/peps/pep-0249/ >> I would like to access the database connected by ODBC and am looking >> for a >> sample code for that. >> >> If you have it, Could you kindly let me know about it, please? > > You should look at http://pyodbc.sourceforge.net/ > From mal at egenix.com Tue Sep 11 16:42:20 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Tue, 11 Sep 2007 16:42:20 +0200 Subject: [DB-SIG] questions for Python Database API Specification v2.0 In-Reply-To: References: Message-ID: <46E6A94C.8040003@egenix.com> On 2007-09-11 08:06, Sakesun Roykiattisak wrote: > Hi, > > Just curious. > > What's the different between pyodbc and ceodbc ? > Cant the two project merged ? > > Given that the ODBC binary api is stable, I believe python-odbc can be > based on ctypes. > This way the re-compilation would no longer needed. You're underestimating the complexity of the ODBC API specification and the hundreds of implementations of it out there. > On Mon, 10 Sep 2007 16:58:19 +0700, William Dode wrote: > >> On 10-09-2007, Satomi Ninomiya wrote: >> >>> Dear Sir/Madam, >>> >>> Nice to meet you. >>> I have a question about Python Database API Specification v2.0. >>> http://www.python.org/dev/peps/pep-0249/ >>> I would like to access the database connected by ODBC and am looking >>> for a >>> sample code for that. >>> >>> If you have it, Could you kindly let me know about it, please? >> You should look at http://pyodbc.sourceforge.net/ >> > > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Sep 11 2007) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2007-08-22: Released mxODBC 3.0.1 http://python.egenix.com/ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX 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 From kskuhlman at redlagoon.net Tue Sep 11 19:08:39 2007 From: kskuhlman at redlagoon.net (Ken Kuhlman) Date: Tue, 11 Sep 2007 12:08:39 -0500 Subject: [DB-SIG] ANN: acute-dbapi 0.1dev Message-ID: <8b2c5350709111008n14bfb122q97e77af75b488ffa@mail.gmail.com> I'm pleased to announce the kick-off of acute-dbapi, a DB-API compliance test suite. Acute is still in it's infancy, but it's reached the level of maturity that it would benefit from community input. It currently contains 71 tests, and many more will be added soon. Comments, suggestions, and patches are all warmly welcome. Harsh criticism can wait until the 1.0 release, however. There are several TODOs listed in the TODO file, and many more generously sprinkled throughout the code; if you'd like to help out but don't know where to begin, feel free to take a crack at one of them! >From the README: == Introduction == acute-dbapi is a testsuite for Python database drivers to check their compliance against the DB-API 2.0 standard (PEP 249). It is also intended to test common implementation features that haven't yet found their way into DB-API specification. Acute was was originally derived from Stuart Bishop's DBAPI20TestSuite `[1]`, and it's name stands for "Anal Compliance Unit Test Environment," which is a tip-of-the-hat to Stuart, who described his testsuite in those terms `[2]`. Acute-dbapi is very much a work in progress. Feel free to contribute patches for anything you see that's out of place! == Usage == To use, first checkout the current trunk: svn co https://acute-dbapi.googlecode.com/svn/trunk acute-dbabpi Then cd to acute-dbapi/acute and update config.py to match your database driver, the database name to use & your credentials for that database. You're then ready to run the testsuite with: python test-dbapi.py == Adding Support for Drivers == acute-dbapi currently supports pysqlite2, MySQLdb, and psycopg2. There are reports on driver functionality at the project's "wiki" as DriverFeatures `[3]` and TestResults `[4]`. There is a list of driver-supported features in "features.py". A set of class attributes on the `SupportedFeatures` class define the default, expected, behavior for each feature. These are overridden for each driver in the initialization method of the class to specify any quirks of the driver's implementation. == Architecture == The testsuite is designed such that all tests are expected to pass when the driver's features are setup correctly in "features.py". There are two mechanisms to support this: first, if a feature under test isn't supported by a driver, then that test will still be run but will be converted to an 'Unsupported' status upon failure; if the test succeeds despite the fact that the driver is declared to not support the feature, then the second mechanism kicks in and the testsuite raises an `UnexpectedSuccess` error. The only tests that will be skipped are those that are under active development (these are the tests that are declared with @require('amiracle')). This setup makes it simpler to track which tests are truly in error versus the known failings of the driver. Tests that are under active development will be skipped. These tests are declared with a @require('amiracle') decorator. == Philosophy == * Extensive unit tests improve code quality, allow developers to be more courageous in making aggressive changes, and improve user's ability to provide bug feedback. * Sharing applicable tests between projects strengthens standards and saves time when developing new compliant modules. * The "least common denominator" approach of the DB-API 2.0 standard was necessary in Python's infancy, but technologies have matured to the point where further possibilities for standardization exist. Common features that haven't reached ubiquity should be made optional, not simply ignored or too lightly left as an "implementation extension." The same process has occurred with SQL -- SQL 89 was very light, SQL 92 introduced conformance levels, and SQL 1999 greatly expanded on them. `[5]` == Finally == The project's homepage is at: http://code.google.com/p/acute-dbapi/. acute-dbapi is licensed under the MIT license (see LICENSE). enjoy! ==== Footnotes ==== *1 Stuart Bishop's DB-API test suite is available at http://stuartbishop.net/Software/DBAPI20TestSuite/ . *2 The initial thread on Stuart Bishop's tests is at http://mail.python.org/pipermail/db-sig/2003-February/003116.html. There were several separate threads on the topic, so be sure to review all of February, March, and April 2003's archives as well ( http://mail.python.org/pipermail/db-sig/2003-February). Here's a bit of humor taken from one of the earlier threads: "Now we have booze and barflies entering the discussion, plus rumours of DBAs on drugs... and I won't tell you what flashes through my mind each time I read the subject line with 'Anal Compliance' in it. All around this is turning out to be a thoroughly unwholesome unit test." -- Ian Bicking *3 http://code.google.com/p/acute-dbapi/wiki/DriverFeatures *4 http://code.google.com/p/acute-dbapi/wiki/TestResults *5 http://www.postgresql.org/docs/8.2/static/features.html Thanks! -Ken -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20070911/04bc0462/attachment.htm From sakesun at boonthavorn.com Wed Sep 12 05:38:53 2007 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Wed, 12 Sep 2007 10:38:53 +0700 Subject: [DB-SIG] questions for Python Database API Specification v2.0 In-Reply-To: <46E6A94C.8040003@egenix.com> References: <46E6A94C.8040003@egenix.com> Message-ID: Still wonder .. >> Given that the ODBC binary api is stable, I believe python-odbc can be >> based on ctypes. >> This way the re-compilation would no longer needed. > You're underestimating the complexity of the ODBC API specification > and the hundreds of implementations of it out there. In general, I think Python is the best bet to fight with "complexity". What is the technical aspect that ctypes cannot work around it ? From info at egenix.com Wed Sep 12 17:24:47 2007 From: info at egenix.com (eGenix Team: M.-A. Lemburg) Date: Wed, 12 Sep 2007 17:24:47 +0200 Subject: [DB-SIG] ANN: eGenix mxODBC and mxODBC Zope DA on 64-bit FreeBSD Message-ID: <46E804BF.3060307@egenix.com> ________________________________________________________________________ ANNOUNCING eGenix.com mxODBC Database Interface eGenix.com mxODBC Zope Database Adapter for 64-bit FreeBSD This announcement is also available on our web-site for online reading: http://www.egenix.com/company/news/eGenix-mxODBC-on-FreeBSD-amd64-GA.html ________________________________________________________________________ eGenix mxODBC Distribution The eGenix mxODBC Distribution is a Python database interface add-on distribution for our eGenix mx Base Distribution. It comes with mxODBC, our universal ODBC database interface for Python. Customers who have purchased licenses for other platforms and wish to move their installation to FreeBSD 64-bit, can do so without having to buy a new license. The licenses will continue to work on the 64-bit platform. Users of mxODBC 2.0 will have to purchase new licenses from our online shop in order to upgrade to mxODBC 3.0. You can request 30-day evaluation licenses on the product page. Downloads --------- Please visit the eGenix mxODBC Distribution page for downloads, instructions on installation and documentation of the packages. http://www.egenix.com/products/python/mxODBC/ Note that in order to use the eGenix mxODBC Distribution you need to install the eGenix mx Base Distribution first. ________________________________________________________________________ eGenix mxODBC Zope DA eGenix mxODBC Zope DA is our database interface for Zope and Plone. It is based on the mxODBC interface. Customers who have purchased licenses for other platforms and wish to move their installation to FreeBSD 64-bit, can do so without having to buy a new license. The licenses will continue to work on the 64-bit platform. You can request 30-day evaluation licenses on the product page. Downloads --------- Please visit the eGenix mxODBC Zope DA product page for downloads, instructions on installation and documentation of the packages. http://www.egenix.com/products/zope/mxODBCZopeDA/ ________________________________________________________________________ More Information For more information on our products, licensing and download instructions, please write to sales at egenix.com. Enjoy, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Sep 12 2007) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2007-08-22: Released mxODBC 3.0.1 http://python.egenix.com/ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX 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 From ca17005 at bellsouth.net Wed Sep 12 19:04:49 2007 From: ca17005 at bellsouth.net (ca17005 at bellsouth.net) Date: Wed, 12 Sep 2007 17:04:49 +0000 Subject: [DB-SIG] inserting or importing csv file to a sqlite3 connected table Message-ID: <091220071704.29746.46E81C31000904AB0000743222230647629B0A02D2089B9A019C04040A0DBFCACFCFC9CE0E0C@bellsouth.net> Very new at this. If I can get sample code for converting a csv file to one that will accept SQL commands then I have gotten over a big hump. Any sample Code known that might work? I have attached a copy of the typical file I will be working with. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20070912/cae515e8/attachment.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/octet-stream Size: 12112 bytes Desc: not available Url : http://mail.python.org/pipermail/db-sig/attachments/20070912/cae515e8/attachment.obj From Chris.Clark at ingres.com Wed Sep 12 19:35:43 2007 From: Chris.Clark at ingres.com (Chris Clark) Date: Wed, 12 Sep 2007 10:35:43 -0700 Subject: [DB-SIG] inserting or importing csv file to a sqlite3 connected table In-Reply-To: <091220071704.29746.46E81C31000904AB0000743222230647629B0A02D2089B9A019C04040A0DBFCACFCFC9CE0E0C@bellsouth.net> References: <091220071704.29746.46E81C31000904AB0000743222230647629B0A02D2089B9A019C04040A0DBFCACFCFC9CE0E0C@bellsouth.net> Message-ID: <46E8236F.5030907@ingres.com> Have you taken a look at http://pyxmdb.googlepages.com/ Chris From darcy at druid.net Wed Sep 12 19:31:40 2007 From: darcy at druid.net (D'Arcy J.M. Cain) Date: Wed, 12 Sep 2007 13:31:40 -0400 Subject: [DB-SIG] inserting or importing csv file to a sqlite3 connected table In-Reply-To: <091220071704.29746.46E81C31000904AB0000743222230647629B0A02D2089B9A019C04040A0DBFCACFCFC9CE0E0C@bellsouth.net> References: <091220071704.29746.46E81C31000904AB0000743222230647629B0A02D2089B9A019C04040A0DBFCACFCFC9CE0E0C@bellsouth.net> Message-ID: <20070912133140.613423ba.darcy@druid.net> On Wed, 12 Sep 2007 17:04:49 +0000 ca17005 at bellsouth.net wrote: > Very new at this. If I can get sample code for converting a csv file to one that will accept SQL commands then I have gotten over a big hump. Any sample Code known that might work? I have attached a copy of the typical file I will be working with. Just use the CSV module. See http://docs.python.org/lib/module-csv.html for description and samples. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. From carsten at uniqsys.com Wed Sep 12 20:08:43 2007 From: carsten at uniqsys.com (Carsten Haese) Date: Wed, 12 Sep 2007 14:08:43 -0400 Subject: [DB-SIG] inserting or importing csv file to a sqlite3 connected table In-Reply-To: <091220071704.29746.46E81C31000904AB0000743222230647629B0A02D2089B9A019C04040A0DBFCACFCFC9CE0E0C@bellsouth.net> References: <091220071704.29746.46E81C31000904AB0000743222230647629B0A02D2089B9A019C04040A0DBFCACFCFC9CE0E0C@bellsouth.net> Message-ID: <1189620523.3448.17.camel@dot.uniqsys.com> On Wed, 2007-09-12 at 17:04 +0000, ca17005 at bellsouth.net wrote: > Very new at this. If I can get sample code for converting a csv file > to one that will accept SQL commands then I have gotten over a big > hump. Take a look at the second code example in http://informixdb.blogspot.com/2007/04/power-of-generators-part-two.html . (Search for the phrase "consider the following naive data loader" to jump to the example.) That example is written for the Informix database and assumes the columns are delimited with "|", but it'll translate easily to sqlite and comma delimiters. Hope this helps, -- Carsten Haese http://informixdb.sourceforge.net From mal at egenix.com Thu Sep 13 14:20:14 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Thu, 13 Sep 2007 14:20:14 +0200 Subject: [DB-SIG] questions for Python Database API Specification v2.0 In-Reply-To: References: <46E6A94C.8040003@egenix.com> Message-ID: <46E92AFE.2040206@egenix.com> Sakesun Roykiattisak wrote: > Still wonder .. > >>> Given that the ODBC binary api is stable, I believe python-odbc can be >>> based on ctypes. >>> This way the re-compilation would no longer needed. > > >> You're underestimating the complexity of the ODBC API specification >> and the hundreds of implementations of it out there. > > > In general, I think Python is the best bet to fight with "complexity". True, but this doesn't always work for C APIs. > What is the technical aspect that ctypes cannot work around it ? They are related to memory management, dealing with pointers and low-level data conversion. Other than these technical issues, you also have to work around various ODBC driver/manager specific issues - only experience helps in solving these. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Sep 13 2007) >>> 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 mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX 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 From sakesun at boonthavorn.com Thu Sep 13 14:32:35 2007 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Thu, 13 Sep 2007 19:32:35 +0700 Subject: [DB-SIG] questions for Python Database API Specification v2.0 In-Reply-To: <46E92AFE.2040206@egenix.com> References: <46E6A94C.8040003@egenix.com> <46E92AFE.2040206@egenix.com> Message-ID: I see. Thanks for the perspective. BTW. If I'd like to get to know more about odbc, what is your recommendation ? I can't find many books on odbc, eventhough it should be the standard db connectivity. Thanks. > Sakesun Roykiattisak wrote: >> Still wonder .. >> >>>> Given that the ODBC binary api is stable, I believe python-odbc can be >>>> based on ctypes. >>>> This way the re-compilation would no longer needed. >> >> >>> You're underestimating the complexity of the ODBC API specification >>> and the hundreds of implementations of it out there. >> >> >> In general, I think Python is the best bet to fight with "complexity". > > True, but this doesn't always work for C APIs. > >> What is the technical aspect that ctypes cannot work around it ? > > They are related to memory management, dealing with pointers and > low-level data conversion. > > Other than these technical issues, you also have to work around > various ODBC driver/manager specific issues - only experience > helps in solving these. > From carl at personnelware.com Fri Sep 21 03:48:09 2007 From: carl at personnelware.com (Carl Karsten) Date: Thu, 20 Sep 2007 20:48:09 -0500 Subject: [DB-SIG] How to get table names from ODBC? In-Reply-To: <46B35DC7.8090608@egenix.com> References: <804e5c70708030823y73bb84a5le295c993150689@mail.gmail.com> <46B35DC7.8090608@egenix.com> Message-ID: <46F322D9.409@personnelware.com> M.-A. Lemburg wrote: > On 2007-08-03 17:23, Lukasz Szybalski wrote: >> Hello, >> I am using python win32 extentions. >> >> I get connected via odbc to a database files that are sitting in the folder. >> >> import dbi,odbc >> db=odbc.odbc('dbfiles') >> cursor=db.cursor() >> cursor.execute('select * from tableabcd') >> print cursor.description >> >> This way I am able to find column names. >> How do i find a available table names? I have 20 tables available to >> me. How do I list their names?? > > With the old odbc module this is not possible without knowing > the database internals. What is described here? http://pyodbc.sourceforge.net/docs.html#cursor_tables Executes SQLTables and creates a results set of tables defined in the data source. Returns the Cursor. for row in cursor.tables(): print row.table_name Is there a comparison between pyodbc, mxodbc, ceodbc - did I mis any? Carl K From mal at egenix.com Fri Sep 21 11:49:21 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Fri, 21 Sep 2007 10:49:21 +0100 Subject: [DB-SIG] How to get table names from ODBC? In-Reply-To: <46F322D9.409@personnelware.com> References: <804e5c70708030823y73bb84a5le295c993150689@mail.gmail.com> <46B35DC7.8090608@egenix.com> <46F322D9.409@personnelware.com> Message-ID: <46F393A1.4060400@egenix.com> Carl Karsten wrote: > M.-A. Lemburg wrote: >> On 2007-08-03 17:23, Lukasz Szybalski wrote: >>> Hello, >>> I am using python win32 extentions. >>> >>> I get connected via odbc to a database files that are sitting in the folder. >>> >>> import dbi,odbc >>> db=odbc.odbc('dbfiles') >>> cursor=db.cursor() >>> cursor.execute('select * from tableabcd') >>> print cursor.description >>> >>> This way I am able to find column names. >>> How do i find a available table names? I have 20 tables available to >>> me. How do I list their names?? >> With the old odbc module this is not possible without knowing >> the database internals. > > What is described here? > > http://pyodbc.sourceforge.net/docs.html#cursor_tables > > Executes SQLTables and creates a results set of tables defined in the data > source. Returns the Cursor. > > for row in cursor.tables(): > print row.table_name > > > Is there a comparison between pyodbc, mxodbc, ceodbc - did I mis any? Yes, you missed the old win32 odbc module which is what I was referring to. mxODBC provides the whole set of ODBC catalog functions in form of cursor methods and this makes it possible to query meta information in a database independent way. For more information, please see the mxODBC documentation. Look for the section 6.3.1 Catalog Methods: http://www.egenix.com/products/python/mxODBC/#Documentation -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source >>> 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 mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From carl at personnelware.com Sun Sep 30 17:21:20 2007 From: carl at personnelware.com (Carl Karsten) Date: Sun, 30 Sep 2007 10:21:20 -0500 Subject: [DB-SIG] odbc module choices Message-ID: <46FFBEF0.2060206@personnelware.com> Why are there 3 opensource odbc modules? and what are the differences between them? From what I can tell, the stock odbc module doesn't implement some important functions, like Tables() and Columns(). Carl K From mal at egenix.com Sun Sep 30 20:27:55 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Sun, 30 Sep 2007 20:27:55 +0200 Subject: [DB-SIG] odbc module choices In-Reply-To: <46FFBEF0.2060206@personnelware.com> References: <46FFBEF0.2060206@personnelware.com> Message-ID: <46FFEAAB.1030403@egenix.com> On 2007-09-30 17:21, Carl Karsten wrote: > Why are there 3 opensource odbc modules? > > and what are the differences between them? > > From what I can tell, the stock odbc module doesn't implement some important > functions, like Tables() and Columns(). mxODBC introduced those catalog methods. Here's a run-down (totally unbiased, of course ;-): The win32 odbc module is really old (it was one of the first database modules written for Python and triggered the DB-API specification). It only supports DB-API 1.0. mxODBC was started in 1997 and maintained ever since. It triggered DB-API spec 2.0 and implements it. mxODBC supports ODBC drivers on all platforms where you can compile Python, including (but not limited to) Windows, Linux, Solaris, Mac OS X, FreeBSD, AIX and HP-UX. It's actively supported&maintained by eGenix. AFAIK, pyodbc has been in development for about a year. It's mostly a Windows module, focusses on MS SQL Server and implements DB-API 2.0. ceodbc has just been released. Can't say much about it. Hope that helps, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Sep 30 2007) >>> 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 mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX 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