From dsturtev at akamai.com Tue Jan 2 16:01:54 2007 From: dsturtev at akamai.com (Dean Sturtevant) Date: Tue, 02 Jan 2007 10:01:54 -0500 Subject: [DB-SIG] meaning of type_code in Cursor .description Message-ID: <459A73E2.405@akamai.com> I have a question as to the "type_code" column in the .description attribute of the Cursor object. How do you recommend a programmer get the meaning of a type_code? The documentation isn't clear on this. Thanks - Dean Sturtevant From aprotin at research.att.com Tue Jan 2 22:05:07 2007 From: aprotin at research.att.com (Art Protin) Date: Tue, 02 Jan 2007 16:05:07 -0500 Subject: [DB-SIG] meaning of type_code in Cursor .description In-Reply-To: <459A73E2.405@akamai.com> References: <459A73E2.405@akamai.com> Message-ID: <459AC903.3020205@research.att.com> Dear Dean, et al, Dean Sturtevant wrote: >I have a question as to the "type_code" column in the .description >attribute of the Cursor object. > >How do you recommend a programmer get the meaning of a type_code? The >documentation isn't clear on this. > > > As I see it (and I am probably wrong, but it may give the others on this list something to refine as verses construct for themself), the specification does a little bit of hand waving and a bunch of indirection for the purpose of building a mapping between what types the databases use and the types in Python. The requirement says that .description must have a seven item sequence for each result column. That should be simple enough. The second item in each of these is the type_code you ask about. Skip ahead to the sections on "Type Objects and Constructor" and "Implementation Hints for Module Authors". The real requirement on type codes, as I understand it, is that if the type_code in the .description matches (compares as equal) to the .STRING attribute of the module then the value returned for that column (in say a .fetchone()) will satisfy isinstance(foo,'str'), and similarly for .BINARY, .NUMBER, .DATETIME, and .ROWID (although I can not tell you what python type to use for that last one). The constructor functions that are required for objects of these types are supposed to enable your programs to be compare results with known values or to insert known values into the tables. However, the actual technique that the implementor uses to provide this functionality is unspecified. Maybe I have it wrong and matching .STRING will not imply isinstance(foo,'str) but rather that foo can be operated on or used where a string would be needed without raising an exception. And a .NUMBER can be used where a long or a float would be required and python can convert it appropriately. The specification does go quite a bit further in describing what is required for values with type_code == .DATETIME in that it even suggests a implementation, "those defined in the mxDateTime package". But even here the implentor is allowed to use any underlying representation that will give a similar appearance (with regard to comparing against or operating with values produced by the constructor functions). (I chose to use the datetime module instead of the mxDateTime module for my interface.) I hope that this is at least a step in the right direction. >Thanks - > >Dean Sturtevant > >_______________________________________________ >DB-SIG maillist - DB-SIG at python.org >http://mail.python.org/mailman/listinfo/db-sig > > Thank you, Arthur Protin From carl at personnelware.com Tue Jan 2 22:32:20 2007 From: carl at personnelware.com (Carl Karsten) Date: Tue, 02 Jan 2007 15:32:20 -0600 Subject: [DB-SIG] bound parameters Message-ID: <459ACF64.9040900@personnelware.com> I just read the thread in http://www.mail-archive.com/db-sig at python.org/msg00478.html and am wondering what is currently 'best' for an application developer if we want our code to be portable across the various db modules? Here is what I am currently doing: import MySQLdb con = MySQLdb.connect(...) cur = con.cursor() ret = cur.execute( "insert into logs (host, facility) values (%(host)s, %(facility)s)", {'host': 'foo3', 'facility': 'bar3'} ) I am also wondering what the best way is to specify object names: print "#1", cur.execute("select count(*) as ncount from `logs`" ) print "#2", cur.execute("select count(*) as ncount from `%s`" %('logs') ) print "#3", cur.execute("select count(*) as ncount from %(table)s", {'table':'logs'} ) ! # errors because it gets quoted with single quote, not back quote. bug? Carl K From carsten at uniqsys.com Tue Jan 2 23:32:31 2007 From: carsten at uniqsys.com (Carsten Haese) Date: Tue, 02 Jan 2007 17:32:31 -0500 Subject: [DB-SIG] bound parameters In-Reply-To: <459ACF64.9040900@personnelware.com> References: <459ACF64.9040900@personnelware.com> Message-ID: <1167777151.3387.35.camel@dot.uniqsys.com> On Tue, 2007-01-02 at 15:32 -0600, Carl Karsten wrote: > print "#3", cur.execute("select count(*) as ncount from %(table)s", > {'table':'logs'} ) ! Using bound parameters for object names virtually guarantees that your code is not portable to other databases. The SQL standard allows placeholders only where expressions are allowed. Databases like MySQL don't enforce this because they rely on string interpolation to do the "parameter passing", but a real database with a real parameter passing API will yell at you: >>> import informixdb >>> conn = informixdb.connect("sysmaster") >>> cur = conn.cursor() >>> cur.execute("select * from ?", ("systables",) ) Traceback (most recent call last): File "", line 1, in ? _informixdb.ProgrammingError: SQLCODE -201 in PREPARE: 42000: Syntax error or access violation If you want true cross-database compatibility, you should use an ORM/abstraction layer like SQLObject or SQLAlchemy which addresses issues such as parameter styles, object naming, and even differences in SQL dialects. -- Carsten Haese | Phone: (419) 861-3331 Software Engineer | Direct Line: (419) 794-2531 Unique Systems, Inc. | FAX: (419) 893-2840 1687 Woodlands Drive | Cell: (419) 343-7045 Maumee, OH 43537 | Email: carsten at uniqsys.com From mumatony-work at yahoo.com Thu Jan 4 18:11:22 2007 From: mumatony-work at yahoo.com (TonyM-Work) Date: Thu, 4 Jan 2007 09:11:22 -0800 (PST) Subject: [DB-SIG] Python Script to run an Oralce select statement and return the value in HTML In-Reply-To: <25ef693e0612210332m51e76b18hc7033d698c35749a@mail.gmail.com> Message-ID: <289478.65583.qm@web31807.mail.mud.yahoo.com> To update everyone; I appreciate your help and contributions. This takes the input variables [username, password, database] and returns the correct values from the command line, but I can not get it to return the values in a html page. I?ve tried = import cgitb; cgitb.enable(); <% - %> ; print ??? ; but keep getting errors in html i.e. DLL load failed: Access is denied; or CGI header error;. The web site has anonymous access and .py extension is allowed in IIS6. Any ideas? I know this is a simple single query but all I?m trying to test is the connection to an oracle database and a returned value in html. Once this works I can continue configuring an application and server then pass it on to the end users. Do any of you have a Oracle account and website to test this on? Thanks again. Tony ## Command line Code ### #! /usr/local/bin/python ############################################################################### # Oracle.pyw v1.0 Written by Matthew Helle (Hostingmh.com)support at hostingmh.com 20-OCT-2004 # BE CAREFUL EDITING THIS FILE, PYTHON IS INDENT SENSATIVE!!! # Notes: Oracle.pyw is written in Python & used demonstrate how to connect & # run sql queries against a remote Oracle database. #This was tested on Windows and not tested on any other platform.... # Program Location: 1. Anywhere\Oracle.pyw # Requirements: 1. Oracle Client 2. cx_Oracle for Python # Location: http://computronix.com/utilities.shtml #Oracle Error checking: 1. None # History: 1. 20-Oct-2004 Version 1.0 written by Matthew Helle ############################################################################### import string, time, cx_Oracle, #set variables OraUid="NameXXX" #Oracle User OraPwd="NameXXX " #Oracle password OraService="NameXXX" #Oracle Service name From Tnsnames.ora file #get the current date now = string.upper(time.strftime("%d%m", time.localtime(time.time()))) db = cx_Oracle.connect(OraUid + "/" + OraPwd + "@" + OraService) #Connect to database c = db.cursor() #Allocate a cursor c.execute("select * from MIR_SYSTEM_VERSION") #Execute a SQL statement print "Records selected python-> Oracle:" print c.fetchall() #Print all results c.close() #Close the database connection /**************************************** Chris Curvey wrote: I would start by adding import cgitb; cgitb.enable() at the top of your script. Since "hello world" seems to work, and you can get the script to run via the command line, there's probably something different about the environment that IIS is using to execute your script. (99% of the time, I find that it's a permissions problem.) Hope this helps! On 12/21/06, Boeing wrote: Hi all; [Vickie thanks for your sample command line script http://d0db.fnal.gov/d0db/query.py.txt ] I need help [I'm not a developer] but I need a python script hosted on an windows 2003 server which will query a remote Oracle database [odbc connection established] either using Oracle 9.2 or cx_Oracle [both installed on the server] but return the value of the query in an html [web - URL] page, Username; password and database will be hard coded in the script on the server, script code will not be displayed to end user. Its a simple select statement returning a html page in rows. Eventually SSL is going to be implemented. I have been able to get the command line py script to work [Vickie White's]. But not calling it through IIS 6. I get this error: CGI Error: The specified CGI application misbehaved by not returning a complete set of HTTP headers. But the python extension has been "Allowed" in IIS and a simple "Hello World" python script works. [[ i.e. not real URLs: http://metatest.web.mycompany.com/cgi-bin/helloworld.py]] Failing: http://metatest.web.mycompany.com/cgi-bin/or3.py Sample for what I've gathered so far.. #!/usr/bin/python print "Content-type: text/html\n\n"; print ""; } } import cx_Oracle } } def connect(): username = "typeUserNameHere" [hard coded] password = "typePassHere" [hard coded] database = "typeDataBaseHere" [hard coded] } Query: } } "select * from MIR_SYSTEM_VERSION" Any ideas or help [sample code] would be appreciated. _______________________________________________ DB-SIG maillist - DB-SIG at python.org http://mail.python.org/mailman/listinfo/db-sig -- I am often wrong, but I am never in doubt. ***************** Thank you, Tony Muma "The most valuable thing you can ever give another person is Your 'Time?. Once you give it you can never get it back, so appreciate the time you share with others." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20070104/31d6b5b4/attachment.htm From haraldarminmassa at gmail.com Mon Jan 8 19:01:55 2007 From: haraldarminmassa at gmail.com (Harald Armin Massa) Date: Mon, 8 Jan 2007 19:01:55 +0100 Subject: [DB-SIG] comparing with lists via cx_Oracle Message-ID: <7be3f35d0701081001y326d1e74j55d389392fc7e637@mail.gmail.com> Sometimes I have to get additional data for a set of ids, the usual select of select whatever from sometable where id in (1,2,3,4,5) Next level is, [1,2,3,4,5] is a Collection in Python (List, Tuple, Set) to transcribe it as cs.execute("select whatever from sometable where id in (%(pyeles)s)", dict(pyeles=[1,2,3,4,5])) obviously does not work. within PostgreSQL and psycopg2 I can write: cs.execute("""select name from kundentable where id_p = any(%(ids)s)""", dict(ids=[8718, 27339, 108509463, 9113, 14951])) which gets translated to cs.query 'select name from kundentable where id_p = any(ARRAY[8718, 27339, 108509463, 9113, 14951])' and yields the appropriate result. oracle supports something similar with select name from kundentable where id_p=any(8718, 27339, 108509463, 9113, 14951) BUT... how can I get that list of ID_S from Python to Oracle via cx_Oracle? Harald -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Reinsburgstra?e 202b 70197 Stuttgart 0173/9409607 - Python: the only language with more web frameworks than keywords. From fog at initd.org Mon Jan 8 19:47:56 2007 From: fog at initd.org (Federico Di Gregorio) Date: Mon, 08 Jan 2007 19:47:56 +0100 Subject: [DB-SIG] comparing with lists via cx_Oracle In-Reply-To: <7be3f35d0701081001y326d1e74j55d389392fc7e637@mail.gmail.com> References: <7be3f35d0701081001y326d1e74j55d389392fc7e637@mail.gmail.com> Message-ID: <1168282076.3033.2.camel@localhost> Il giorno lun, 08/01/2007 alle 19.01 +0100, Harald Armin Massa ha scritto: > within PostgreSQL and psycopg2 I can write: > > cs.execute("""select name from kundentable > where id_p = any(%(ids)s)""", > dict(ids=[8718, 27339, 108509463, 9113, 14951])) > > which gets translated to > cs.query > 'select name from kundentable > where id_p = any(ARRAY[8718, 27339, 108509463, 9113, 14951])' Completely off-topic but in psycopg2 you can do even better if you import psycopg2.extras and then use a tuple. It will get adapted into the right parenthesized form for SQL IN operator. federico -- Federico Di Gregorio http://people.initd.org/fog Debian GNU/Linux Developer fog at debian.org INIT.D Developer fog at initd.org I'm hung like Einstein and smart as a horse! -- Trottalemme -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Questa =?ISO-8859-1?Q?=E8?= una parte del messaggio firmata digitalmente Url : http://mail.python.org/pipermail/db-sig/attachments/20070108/e9504dd7/attachment.pgp From carl at personnelware.com Tue Jan 9 03:42:22 2007 From: carl at personnelware.com (Carl Karsten) Date: Mon, 08 Jan 2007 20:42:22 -0600 Subject: [DB-SIG] bound parameters In-Reply-To: <1167777151.3387.35.camel@dot.uniqsys.com> References: <459ACF64.9040900@personnelware.com> <1167777151.3387.35.camel@dot.uniqsys.com> Message-ID: <45A3010E.7020909@personnelware.com> Carsten Haese wrote: > On Tue, 2007-01-02 at 15:32 -0600, Carl Karsten wrote: >> print "#3", cur.execute("select count(*) as ncount from %(table)s", {'table':'logs'} ) ! > > Using bound parameters for object names virtually guarantees that your > code is not portable to other databases. Not surprised. not too concerned about it either. object names are normally fairly sane, and not dynamic enough to worry about them cropping up later in production. > The SQL standard allows > placeholders only where expressions are allowed. Is that a sql-92 thing? I skimmed the spec and couldn't find anything. but I may not have been looking for the right terms, and I sure didn't read it start to finish. http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt > Databases like MySQL > don't enforce this because they rely on string interpolation to do the > "parameter passing", but a real database with a real parameter passing > API will yell at you: > >>>> import informixdb >>>> conn = informixdb.connect("sysmaster") >>>> cur = conn.cursor() >>>> cur.execute("select * from ?", ("systables",) ) > Traceback (most recent call last): > File "", line 1, in ? > _informixdb.ProgrammingError: SQLCODE -201 in PREPARE: 42000: Syntax error or access violation > > If you want true cross-database compatibility, you should use an > ORM/abstraction layer like SQLObject or SQLAlchemy which addresses > issues such as parameter styles, object naming, and even differences in > SQL dialects. > That is actually why I am looking into this: the data classes in dabo - same concept as SQLObject or SQLAlchemy, different implementation. Carl K From sdavis2 at mail.nih.gov Tue Jan 9 17:27:11 2007 From: sdavis2 at mail.nih.gov (Sean Davis) Date: Tue, 9 Jan 2007 11:27:11 -0500 Subject: [DB-SIG] Accessing oracle from remote machine Message-ID: <200701091127.11739.sdavis2@mail.nih.gov> I am new to the list, so if I am in the wrong place, feel free to direct me elsewhere. I am trying to connect to an Oracle installation on a remote machine. I have installed the oracle instant client on my machine (linux x84_64) and can connect via Oracle's sqlplus client to the remote machine. So, my question is what are the working options for connecting from python when I do not have an entire installation in place but only instantclient? Thanks, Sean From dieter at handshake.de Tue Jan 9 19:57:03 2007 From: dieter at handshake.de (Dieter Maurer) Date: Tue, 9 Jan 2007 19:57:03 +0100 Subject: [DB-SIG] comparing with lists via cx_Oracle In-Reply-To: <7be3f35d0701081001y326d1e74j55d389392fc7e637@mail.gmail.com> References: <7be3f35d0701081001y326d1e74j55d389392fc7e637@mail.gmail.com> Message-ID: <17827.58751.418260.396088@gargle.gargle.HOWL> Harald Armin Massa wrote at 2007-1-8 19:01 +0100: >Sometimes I have to get additional data for a set of ids, the usual select of > >select whatever from sometable where id in (1,2,3,4,5) > >Next level is, [1,2,3,4,5] is a Collection in Python (List, Tuple, Set) > >to transcribe it as > >cs.execute("select whatever from sometable where id in (%(pyeles)s)", >dict(pyeles=[1,2,3,4,5])) > >obviously does not work. Does "cx_Oracle" support Python parameter style? Maybe not. Then use a parameter style supported by "cx_Oracle". If the problem is not the parameter style, it may be the sequence --> string conversion. In this case, use can use ",".join([1,2,3,4,5]) instead of "[1,2,3,4,5]". -- Dieter From haraldarminmassa at gmail.com Tue Jan 9 21:03:19 2007 From: haraldarminmassa at gmail.com (Harald Armin Massa) Date: Tue, 9 Jan 2007 21:03:19 +0100 Subject: [DB-SIG] comparing with lists via cx_Oracle In-Reply-To: <17827.58751.418260.396088@gargle.gargle.HOWL> References: <7be3f35d0701081001y326d1e74j55d389392fc7e637@mail.gmail.com> <17827.58751.418260.396088@gargle.gargle.HOWL> Message-ID: <7be3f35d0701091203ja9c32f5oa44786e8386d39de@mail.gmail.com> Dieter, > >cs.execute("select whatever from sometable where id in (%(pyeles)s)", > >dict(pyeles=[1,2,3,4,5])) > Does "cx_Oracle" support Python parameter style? It does not, my fault. That's not the problem I am focussed on. cx_Oracle supports a "Oracle-Style Parameter fitted to Python dicts", that is: > >cs.execute("select whatever from sometable where id in (:pyeles)", > >dict(pyeles=[1,2,3,4,5])) > >cs.execute("select whatever from sometable where id in (%(pyeles)s)", > >dict(pyeles=[1,2,3,4,5])) "would" work. > If the problem is not the parameter style, it may be the > sequence --> string conversion. In this case, use can use > ",".join([1,2,3,4,5]) > instead of "[1,2,3,4,5]". There MUST NOT be a conversion to a string. It has to be a "sequence" or whatever that would be within Oracles SQL. Just imagine not having numeric IDs, but Strings: ["isK9","kloN","kJni"] as ID. I went down that ", ".join(whatever) way; even to the ", ".join("'%s'" % (a,) for a in sequence) way (those many "' are single quotes quoted with double quotes), and it works. BUT ... it forces me to construct the SQL query via Python String functions, and to do all the necessary escaping of parameters in Python. That is considered BAD, because then I have to deal with all the escaping challenges - that's the entrence door of most PHP vulnerabilities. Parameters should be escaped via the database adapter. .... So I am looking for the way to pass sequence parameters into Oracles throat :) Best wishes, Harald -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Reinsburgstra?e 202b 70197 Stuttgart 0173/9409607 - Python: the only language with more web frameworks than keywords. From mal at egenix.com Wed Jan 10 00:30:10 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Wed, 10 Jan 2007 00:30:10 +0100 Subject: [DB-SIG] comparing with lists via cx_Oracle In-Reply-To: <7be3f35d0701091203ja9c32f5oa44786e8386d39de@mail.gmail.com> References: <7be3f35d0701081001y326d1e74j55d389392fc7e637@mail.gmail.com> <17827.58751.418260.396088@gargle.gargle.HOWL> <7be3f35d0701091203ja9c32f5oa44786e8386d39de@mail.gmail.com> Message-ID: <45A42582.6050306@egenix.com> On 2007-01-09 21:03, Harald Armin Massa wrote: >> If the problem is not the parameter style, it may be the >> sequence --> string conversion. In this case, use can use >> ",".join([1,2,3,4,5]) >> instead of "[1,2,3,4,5]". > > There MUST NOT be a conversion to a string. > > It has to be a "sequence" or whatever that would be within Oracles SQL. The standard SQL notation for value lists in SQL is x in (value1, value2, ...) so this should work pretty much with every SQL database. If you have numbers as sequence elements, the Python tuple representation works just fine. For strings, things are harder, but then I wouldn't recommend using IN predicates with strings anyway - it's better to map the strings to integers via an extra table (if possible). Note that you can also write: (x == value1) or (x == value2) ... and then the valueN references using binding parameters. That way you avoid having to deal with escaping - you still have to construct the SQL depending on the number of values you have. If you have lots of sequence members, it's probably easier to create a temporary table, fill it with the sequence members using INSERT and then do a sub-select: select y from z where x in (select value from temptable) If you have string members in your sequence, there's also another method you could try: several databases have functions for doing substring-search. All you'd have to do is join all the members using e.g. ',' (provided none of the members has this character) and the do something like: select y from z where index(values, ',' & x & ',') > 0 You can then replace values with a binding parameter to avoid the escaping. > Just imagine not having numeric IDs, but Strings: > > ["isK9","kloN","kJni"] > > as ID. > > I went down that ", ".join(whatever) way; even to the ", ".join("'%s'" > % (a,) for a in sequence) > > way (those many "' are single quotes quoted with double quotes), and it works. > > BUT ... it forces me to construct the SQL query via Python String > functions, and to do all the necessary escaping of parameters in > Python. That is considered BAD, because then I have to deal with all > the escaping challenges - that's the entrence door of most PHP > vulnerabilities. It's not all that bad if you know which backend you're dealing with :-) The SQL injection in PHP often has to do with MySQL being used as backend which supports a gazillion and one ways to do escaping. This makes it hard to write a catch-all escaping function. > Parameters should be escaped via the database adapter. .... So I am > looking for the way to pass sequence parameters into Oracles throat :) See above: there are other ways this can be done using portable SQL. BTW, sequences in DB-talk are objects which you can use as auto-increment integer source, e.g. for creating ids of new rows. Hope this helps, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 09 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,FreeBSD for free ! :::: From haraldarminmassa at gmail.com Wed Jan 10 07:07:09 2007 From: haraldarminmassa at gmail.com (Harald Armin Massa) Date: Wed, 10 Jan 2007 07:07:09 +0100 Subject: [DB-SIG] comparing with lists via cx_Oracle In-Reply-To: <45A42582.6050306@egenix.com> References: <7be3f35d0701081001y326d1e74j55d389392fc7e637@mail.gmail.com> <17827.58751.418260.396088@gargle.gargle.HOWL> <7be3f35d0701091203ja9c32f5oa44786e8386d39de@mail.gmail.com> <45A42582.6050306@egenix.com> Message-ID: <7be3f35d0701092207h411b82d5o29f69d5a6507632@mail.gmail.com> Marc-Andre, > The standard SQL notation for value lists in SQL is > > x in (value1, value2, ...) > > so this should work pretty much with every SQL database. yes. If I know the number of values beforhand, even parameters work: x in (:value1, :value2, :value3) (for being ":" the parametersubstitution of choice for the database > If you have numbers as sequence elements, the Python tuple > representation works just fine. I am going to test this, if something like "x in (:mypytu)", dict(mypytu=(1,2,3))" works ... thanks for the hint! I stopped testing when I failed with set() and list() :) >For strings, things are harder, but then I wouldn't recommend using IN predicates with >strings anyway - it's better to map the strings to integers via an extra table (if possible). Why is it better? If I get a set of strings from the application, I have to find the fitting integers from the extra table. That again is one in-call; or number-of-strings calls, which for performance reasons esp,. on WAN is not nice :( > Note that you can also write: > (x == value1) or (x == value2) ... Thanks for the reminder! > That way you avoid having to deal with escaping - you still > have to construct the SQL depending on the number of values > you have. I think that is a good trade. "Constructing SQL" is a easier to test then "correctly escaping every *** that somebody puts in" :) > several databases have functions > for doing substring-search. All you'd have to do is join all > the members using e.g. ',' (provided none of the members > has this character) and the do something like: WOW! Thats a nice trick, thinking out of the box ... thanks! > BTW, sequences in DB-talk are objects which you can use as > auto-increment integer source, e.g. for creating ids of > new rows. Yes. Maybe that makes it hard to google up a solution for my challenge :) Thanks for your great hints, best wishes, Harald (cu @ EP2007 ? ) -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Reinsburgstra?e 202b 70197 Stuttgart 0173/9409607 - Python: the only language with more web frameworks than keywords. From andy47 at halfcooked.com Wed Jan 10 08:31:42 2007 From: andy47 at halfcooked.com (Andy Todd) Date: Wed, 10 Jan 2007 18:31:42 +1100 Subject: [DB-SIG] Accessing oracle from remote machine In-Reply-To: <200701091127.11739.sdavis2@mail.nih.gov> References: <200701091127.11739.sdavis2@mail.nih.gov> Message-ID: <45A4965E.40704@halfcooked.com> Sean Davis wrote: > I am new to the list, so if I am in the wrong place, feel free to direct me > elsewhere. > > I am trying to connect to an Oracle installation on a remote machine. I have > installed the oracle instant client on my machine (linux x84_64) and can > connect via Oracle's sqlplus client to the remote machine. > > So, my question is what are the working options for connecting from python > when I do not have an entire installation in place but only instantclient? > > Thanks, > Sean > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig Sean, If you can connect using SQL*Plus then you can connect with a Python DB-API 2.0 module such as cx_Oracle [1] because they use the same connection mechanism. Just use the same connection string. e.g. if you use $ sqlplus scott/tiger at remotedb at the command line then in Python you can just do something like; >>> import cx_Oracle >>> remote_db = cx_Oracle.connect('scott/tiger at remotedb') I'd have a look at the documentation of whichever module you choose to find out how to get the best out of it though. [1] http://www.python.net/crew/atuining/cx_Oracle/ Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From ghankiewicz at rastertech.es Wed Jan 10 11:10:04 2007 From: ghankiewicz at rastertech.es (Grzegorz Adam Hankiewicz) Date: Wed, 10 Jan 2007 11:10:04 +0100 Subject: [DB-SIG] Several newbie questions Message-ID: <45A4BB7C.7000204@rastertech.es> Hello. I'm new to the world of Python database access. I've read the DB-API documents and find the 2.0 version pretty nice. However, for my current work I have to access a local .mdb file. I've already been able to do it with the pywin32 odbc module, which AFAIK it conforms to the DB-API 1.0. I've found adodbapi, which says it is 2.0, but it fails with huge fireworks trying to access tables with binary objects (something about COM objects being unknown), so I can't use it. I've tried contacting the author but I'm waiting for any answer. Is it right that there is no other MS Access python module? I guess I'll have to use odbc then. Also, the DB-API 2.0 spec says several things about yet to be solved issues, like loss-less currency types and such. Is there anywhere a roadmap about this? Is a DB-API 3.0 in the works? I've tried contacting the webmaster at python.org to tell that there's no link for adodbapi and the odbc documentation/hint links are borken, but have received no answer. Also, I've found http://adodb.sourceforge.net/ not listed on those pages. It says it should work with access through odbc. Has somebody tried this with success? The python documentation mentions that it has to drift from the DB-API 2.0 spec due to limitations in how rows are retrieved. Is this some sort of big split in the Python database community? I mean, is this going to be addressed by a future PEP or are people leaving DB-API 2.0 in favor of the adodb api? -- Grzegorz Adam Hankiewicz, Jefe de producto de TeraVial Rastertech Espa?a S.A. Tel: +34 918 467 390, ext 18. http://www.rastertech.es/ ghankiewicz at rastertech.es From sdavis2 at mail.nih.gov Wed Jan 10 11:59:42 2007 From: sdavis2 at mail.nih.gov (Sean Davis) Date: Wed, 10 Jan 2007 05:59:42 -0500 Subject: [DB-SIG] Accessing oracle from remote machine In-Reply-To: <45A4965E.40704@halfcooked.com> References: <200701091127.11739.sdavis2@mail.nih.gov> <45A4965E.40704@halfcooked.com> Message-ID: <200701100559.42585.sdavis2@mail.nih.gov> On Wednesday 10 January 2007 02:31, Andy Todd wrote: > Sean Davis wrote: > > I am new to the list, so if I am in the wrong place, feel free to direct > > me elsewhere. > > > > I am trying to connect to an Oracle installation on a remote machine. I > > have installed the oracle instant client on my machine (linux x84_64) and > > can connect via Oracle's sqlplus client to the remote machine. > > > > So, my question is what are the working options for connecting from > > python when I do not have an entire installation in place but only > > instantclient? > > > > Thanks, > > Sean > > _______________________________________________ > > DB-SIG maillist - DB-SIG at python.org > > http://mail.python.org/mailman/listinfo/db-sig > > Sean, > > If you can connect using SQL*Plus then you can connect with a Python > DB-API 2.0 module such as cx_Oracle [1] because they use the same > connection mechanism. Just use the same connection string. > > e.g. if you use > > $ sqlplus scott/tiger at remotedb > > at the command line then in Python you can just do something like; > > >>> import cx_Oracle > >>> remote_db = cx_Oracle.connect('scott/tiger at remotedb') > > I'd have a look at the documentation of whichever module you choose to > find out how to get the best out of it though. > > [1] http://www.python.net/crew/atuining/cx_Oracle/ Thanks, Andy. This is indeed the route I have gone and it works like a charm. Just an aside, I learned that one must install the SDK from oracle, a requirement above-and-beyond the standard SQL*Plus, which will work fine without the SDK. A minor point, but it was cause for a bit of confusion for me. Sean From mal at egenix.com Wed Jan 10 22:10:59 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Wed, 10 Jan 2007 22:10:59 +0100 Subject: [DB-SIG] Several newbie questions In-Reply-To: <45A4BB7C.7000204@rastertech.es> References: <45A4BB7C.7000204@rastertech.es> Message-ID: <45A55663.5030202@egenix.com> On 2007-01-10 11:10, Grzegorz Adam Hankiewicz wrote: > Hello. > > I'm new to the world of Python database access. I've read the DB-API > documents and find the 2.0 version pretty nice. However, for my current > work I have to access a local .mdb file. > > I've already been able to do it with the pywin32 odbc module, which > AFAIK it conforms to the DB-API 1.0. I've found adodbapi, which says it > is 2.0, but it fails with huge fireworks trying to access tables with > binary objects (something about COM objects being unknown), so I can't > use it. I've tried contacting the author but I'm waiting for any answer. > > Is it right that there is no other MS Access python module? I guess I'll > have to use odbc then. Try our mxODBC package (included in egenix-mx-commercial). This has no problems accessing Access tables, provided you have the Access ODBC drivers installed. You can get those from the MS MDAC site: http://http://msdn.microsoft.com/data/Default.aspx (download the MDAC package). > Also, the DB-API 2.0 spec says several things about yet to be solved > issues, like loss-less currency types and such. Is there anywhere a > roadmap about this? Is a DB-API 3.0 in the works? I think we should try for a DB-API 3.0 this year. I had planned to start the process late last year, but then a whole lot of other things kept me getting on with it. > I've tried contacting the webmaster at python.org to tell that there's > no link for adodbapi and the odbc documentation/hint links are borken, > but have received no answer. > > Also, I've found http://adodb.sourceforge.net/ not listed on those > pages. It says it should work with access through odbc. If you want to use ADO, you should use the ADO drivers. Using ADO to talk to the database through ODBC is just adding an API stack on top. > Has somebody > tried this with success? The python documentation mentions that it has > to drift from the DB-API 2.0 spec due to limitations in how rows are > retrieved. Is this some sort of big split in the Python database > community? I mean, is this going to be addressed by a future PEP or are > people leaving DB-API 2.0 in favor of the adodb api? Very unlikely :-) DB-API has been around for more than 10 years now and the number of available database modules written against the spec proves that it has had success in achieving its goal, namely to provide a platform on which to build database application for Python. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 10 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,FreeBSD for free ! :::: From mal at egenix.com Wed Jan 10 22:15:20 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Wed, 10 Jan 2007 22:15:20 +0100 Subject: [DB-SIG] comparing with lists via cx_Oracle In-Reply-To: <7be3f35d0701092207h411b82d5o29f69d5a6507632@mail.gmail.com> References: <7be3f35d0701081001y326d1e74j55d389392fc7e637@mail.gmail.com> <17827.58751.418260.396088@gargle.gargle.HOWL> <7be3f35d0701091203ja9c32f5oa44786e8386d39de@mail.gmail.com> <45A42582.6050306@egenix.com> <7be3f35d0701092207h411b82d5o29f69d5a6507632@mail.gmail.com> Message-ID: <45A55768.7040404@egenix.com> On 2007-01-10 07:07, Harald Armin Massa wrote: > Marc-Andre, > >> The standard SQL notation for value lists in SQL is >> >> x in (value1, value2, ...) >> >> so this should work pretty much with every SQL database. > > yes. If I know the number of values beforhand, even parameters work: > > x in (:value1, :value2, :value3) > > (for being ":" the parametersubstitution of choice for the database > >> If you have numbers as sequence elements, the Python tuple >> representation works just fine. > > I am going to test this, if something like > > "x in (:mypytu)", dict(mypytu=(1,2,3))" > > works ... thanks for the hint! I stopped testing when I failed with > set() and list() :) No that doesn't work. I was hinting at using the representation to simplify formatting the SQL, e.g. 'select y from z where x in %r' % tuple_of_integers >> For strings, things are harder, but then I wouldn't recommend using > IN predicates with >strings anyway - it's better to map the strings to > integers via an extra table (if possible). > > Why is it better? If I get a set of strings from the application, I > have to find the fitting integers from the extra table. That again is > one in-call; or number-of-strings calls, which for performance reasons > esp,. on WAN is not nice :( String lookup is slow. Integer lookup is fast. This approach only works out if you know the set of strings you want to test for in advance. >> Note that you can also write: >> (x == value1) or (x == value2) ... > > Thanks for the reminder! >> That way you avoid having to deal with escaping - you still >> have to construct the SQL depending on the number of values >> you have. > I think that is a good trade. "Constructing SQL" is a easier to test > then "correctly escaping every *** that somebody puts in" :) > >> several databases have functions >> for doing substring-search. All you'd have to do is join all >> the members using e.g. ',' (provided none of the members >> has this character) and the do something like: > WOW! Thats a nice trick, thinking out of the box ... thanks! > >> BTW, sequences in DB-talk are objects which you can use as >> auto-increment integer source, e.g. for creating ids of >> new rows. > Yes. Maybe that makes it hard to google up a solution for my challenge :) > > Thanks for your great hints, > > best wishes, > > Harald > > (cu @ EP2007 ? ) Hopefully. I'd love to visit Vilnius which is supposed to be a very nice city. Cheers, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 10 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,FreeBSD for free ! :::: From andy47 at halfcooked.com Wed Jan 10 22:51:08 2007 From: andy47 at halfcooked.com (Andy Todd) Date: Thu, 11 Jan 2007 08:51:08 +1100 Subject: [DB-SIG] Accessing oracle from remote machine In-Reply-To: <200701100559.42585.sdavis2@mail.nih.gov> References: <200701091127.11739.sdavis2@mail.nih.gov> <45A4965E.40704@halfcooked.com> <200701100559.42585.sdavis2@mail.nih.gov> Message-ID: <45A55FCC.9000003@halfcooked.com> Sean Davis wrote: > On Wednesday 10 January 2007 02:31, Andy Todd wrote: >> Sean Davis wrote: >>> I am new to the list, so if I am in the wrong place, feel free to direct >>> me elsewhere. >>> >>> I am trying to connect to an Oracle installation on a remote machine. I >>> have installed the oracle instant client on my machine (linux x84_64) and >>> can connect via Oracle's sqlplus client to the remote machine. >>> >>> So, my question is what are the working options for connecting from >>> python when I do not have an entire installation in place but only >>> instantclient? >>> >>> Thanks, >>> Sean >>> _______________________________________________ >>> DB-SIG maillist - DB-SIG at python.org >>> http://mail.python.org/mailman/listinfo/db-sig >> Sean, >> >> If you can connect using SQL*Plus then you can connect with a Python >> DB-API 2.0 module such as cx_Oracle [1] because they use the same >> connection mechanism. Just use the same connection string. >> >> e.g. if you use >> >> $ sqlplus scott/tiger at remotedb >> >> at the command line then in Python you can just do something like; >> >> >>> import cx_Oracle >> >>> remote_db = cx_Oracle.connect('scott/tiger at remotedb') >> >> I'd have a look at the documentation of whichever module you choose to >> find out how to get the best out of it though. >> >> [1] http://www.python.net/crew/atuining/cx_Oracle/ > > Thanks, Andy. This is indeed the route I have gone and it works like a charm. > Just an aside, I learned that one must install the SDK from oracle, a > requirement above-and-beyond the standard SQL*Plus, which will work fine > without the SDK. A minor point, but it was cause for a bit of confusion for > me. > > Sean > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig Sean, Is there a documented source for the information about installing the SDK? And which components does it contain? As far as I'm aware, although I haven't tested this myself yet so I stand ready to be corrected, you should only need the instant client and a Python/Oracle DB-API 2.0 module to connect to a database. Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From ghankiewicz at rastertech.es Thu Jan 11 11:20:15 2007 From: ghankiewicz at rastertech.es (Grzegorz Adam Hankiewicz) Date: Thu, 11 Jan 2007 11:20:15 +0100 Subject: [DB-SIG] Several newbie questions In-Reply-To: <45A55663.5030202@egenix.com> References: <45A4BB7C.7000204@rastertech.es> <45A55663.5030202@egenix.com> Message-ID: <45A60F5F.5050407@rastertech.es> M.-A. Lemburg wrote: > If you want to use ADO, you should use the ADO drivers. Using > ADO to talk to the database through ODBC is just adding an API stack > on top. Something like this? http://opensource.theopalgroup.com/files/ADOdb.html -- Grzegorz Adam Hankiewicz, Jefe de producto de TeraVial Rastertech Espa?a S.A. Tel: +34 918 467 390, ext 18. http://www.rastertech.es/ ghankiewicz at rastertech.es From ghankiewicz at rastertech.es Thu Jan 11 11:26:01 2007 From: ghankiewicz at rastertech.es (Grzegorz Adam Hankiewicz) Date: Thu, 11 Jan 2007 11:26:01 +0100 Subject: [DB-SIG] Several newbie questions In-Reply-To: References: Message-ID: <45A610B9.9060802@rastertech.es> Vernon Cole wrote: > Grzegorz, 1) The odbc module in Pywin32 works, mostly, but has not > been maintained in years. Due to the nature of deadlines I'll have to just use that since it is what I got working. Is there somewhere a list of unsupported stuff or things which not work completely right? Where are patches and fixes sent? > 2) The adodbapi module is somewhat more solid, but the author of that > has also disappeared from view. There are several patches to it > (one of them written by me) which should be applied to make it work > better. Someone with enough time and courage is needed to apply with > sourceforge to take over maintenance of the package. I wrote a small script which dumped a database to a text file and the odbc version was like ten times faster. Do you have links to these patches you mention? -- Grzegorz Adam Hankiewicz, Jefe de producto de TeraVial Rastertech Espa?a S.A. Tel: +34 918 467 390, ext 18. http://www.rastertech.es/ ghankiewicz at rastertech.es From mal at egenix.com Thu Jan 11 11:38:44 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Thu, 11 Jan 2007 11:38:44 +0100 Subject: [DB-SIG] Several newbie questions In-Reply-To: <45A60F5F.5050407@rastertech.es> References: <45A4BB7C.7000204@rastertech.es> <45A55663.5030202@egenix.com> <45A60F5F.5050407@rastertech.es> Message-ID: <45A613B4.1050907@egenix.com> On 2007-01-11 11:20, Grzegorz Adam Hankiewicz wrote: > M.-A. Lemburg wrote: >> If you want to use ADO, you should use the ADO drivers. Using >> ADO to talk to the database through ODBC is just adding an API stack >> on top. > > Something like this? > > http://opensource.theopalgroup.com/files/ADOdb.html > That's a Python interface to the ADO stack. I was referring to the ADO drivers for the database. MS changes their name every now and then - they used to be called OLEDB providers, now they call them ADO.NET providers. In any case, ODBC will give you better performance: http://www.microsoft.com/technet/prodtechnol/windows2000serv/technologies/iis/reskit/iischp7.mspx (Table 7.1) http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/389535 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 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/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From sdavis2 at mail.nih.gov Thu Jan 11 12:39:40 2007 From: sdavis2 at mail.nih.gov (Sean Davis) Date: Thu, 11 Jan 2007 06:39:40 -0500 Subject: [DB-SIG] Accessing oracle from remote machine In-Reply-To: <45A55FCC.9000003@halfcooked.com> References: <200701091127.11739.sdavis2@mail.nih.gov> <200701100559.42585.sdavis2@mail.nih.gov> <45A55FCC.9000003@halfcooked.com> Message-ID: <200701110639.40562.sdavis2@mail.nih.gov> On Wednesday 10 January 2007 16:51, Andy Todd wrote: > Sean Davis wrote: > > On Wednesday 10 January 2007 02:31, Andy Todd wrote: > >> Sean Davis wrote: > >>> I am new to the list, so if I am in the wrong place, feel free to > >>> direct me elsewhere. > >>> > >>> I am trying to connect to an Oracle installation on a remote machine. > >>> I have installed the oracle instant client on my machine (linux x84_64) > >>> and can connect via Oracle's sqlplus client to the remote machine. > >>> > >>> So, my question is what are the working options for connecting from > >>> python when I do not have an entire installation in place but only > >>> instantclient? > >>> > >>> Thanks, > >>> Sean > >>> _______________________________________________ > >>> DB-SIG maillist - DB-SIG at python.org > >>> http://mail.python.org/mailman/listinfo/db-sig > >> > >> Sean, > >> > >> If you can connect using SQL*Plus then you can connect with a Python > >> DB-API 2.0 module such as cx_Oracle [1] because they use the same > >> connection mechanism. Just use the same connection string. > >> > >> e.g. if you use > >> > >> $ sqlplus scott/tiger at remotedb > >> > >> at the command line then in Python you can just do something like; > >> > >> >>> import cx_Oracle > >> >>> remote_db = cx_Oracle.connect('scott/tiger at remotedb') > >> > >> I'd have a look at the documentation of whichever module you choose to > >> find out how to get the best out of it though. > >> > >> [1] http://www.python.net/crew/atuining/cx_Oracle/ > > > > Thanks, Andy. This is indeed the route I have gone and it works like a > > charm. Just an aside, I learned that one must install the SDK from > > oracle, a requirement above-and-beyond the standard SQL*Plus, which will > > work fine without the SDK. A minor point, but it was cause for a bit of > > confusion for me. > > > > Sean > > _______________________________________________ > > DB-SIG maillist - DB-SIG at python.org > > http://mail.python.org/mailman/listinfo/db-sig > > Sean, > > Is there a documented source for the information about installing the > SDK? And which components does it contain? > > As far as I'm aware, although I haven't tested this myself yet so I > stand ready to be corrected, you should only need the instant client and > a Python/Oracle DB-API 2.0 module to connect to a database. The information that I know is available at the following link (for the linux version that I downloaded). I appears to me that in order to build the python/oracle module, one probably needs the SDK to link to, but I could be incorrect. I do know that before I installed the SDK, I was unable to build cx_Oracle. After, it worked fine. http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxx86_64soft.html Sean From jeff at taupro.com Thu Jan 11 14:50:06 2007 From: jeff at taupro.com (Jeff Rush) Date: Thu, 11 Jan 2007 07:50:06 -0600 Subject: [DB-SIG] Reminder: Early Bird Registration for PyCon Ending Soon Message-ID: <45A6408E.3080202@taupro.com> Greetings. As co-chair for an upcoming volunteer-run conference in the Dallas (Addison) area I would like to extent an invitation to the members of the DB-SIG. The event is the fifth international Python Conference, being held Feb 23-25, 2007 at the Marriott-Quorum in Addison, with early-bird registration ending Jan 15. The conference draws approximately 400-500 attendees from diverse backgrounds such as scientists from national and medical labs, college/K-12 educators, web engineers and the myriad of IT developers and programming hobbyists. Those new to the Python language are welcome, and we're offering a half-day "Python 101" tutorial on the day before the conference, Thursday Feb 22 to help you get up to speed and better enjoy the rest of the conference. This year we have a variety of talks and tutorials on databases: - The Star Schema in Python - Analysis and Reporting without Overheads (Data Warehousing) - Developing Desktop Applications with Dabo (3-tier framework) - SQLAlchemy -- the Front-to-Back Database Toolkit - SQLSoup (an SQLAlchemy extension) - Tutorial: Using the DB API - Tutorial: Advanced databases with SQLAlchemy Being run by the Python community as a non-profit event, the conference strives to be inexpensive, with registration being only $260 (or $195 if you register prior to Jan 15th), with a further discount for students. On the day before the conference we are running a full day of classroom tutorials (extra charge per class) and then after the conference is a free four-days of sprints, which are informal gatherings of programmers to work together in coding on various projects. Sprints are excellent opportunities to do agile pair-programming side-by-side with experienced programmers and make new friends. Other activities are lightning talks, which are 5-minute presentations to show off a cool technology or spread the word about a project, open space talks, which are spontaneous gatherings around a topic and, new this year, a Python Lab where experienced and novice programmers will work together to solve challenging problems and then present their solutions. The conference is also running four keynote talks by leaders in the programming field, with a special focus on education this year: "The Power of Dangerous Ideas: Python and One Laptop per Child" by Ivan Krstic, senior member of the One Laptop per Child project "Premise: eLearning does not Belong in Public Schools" by Adele Goldberg, of SmallTalk fame "Python 3000" by Guido van Rossum, creator of Python "The Importance of Programming Literacy" by Robert M. "r0ml" Lefkowitz, a frequent speaker at O'Reilly conferences I believe you will find the conference educational and enjoyable. More information about the conference along with the full schedule of presentations with abstracts, is available online: http://us.pycon.org/ Thanks for any help you can give in spreading the word, Jeff Rush Co-Chair PyCon 2007 From carl at personnelware.com Fri Jan 12 02:09:07 2007 From: carl at personnelware.com (Carl Karsten) Date: Thu, 11 Jan 2007 19:09:07 -0600 Subject: [DB-SIG] ms, unicode and errors Message-ID: <45A6DFB3.309@personnelware.com> I am not exactly sure where to post this, so sorry if I am too far OT. I couldn't find any appropriate place on http://pymssql.sourceforge.net There are really 2 problems: unicode and empty error message When I run this code, I get the following: con = pymssql.connect(host='me',user='sa',password='abc',database='northwind' ) cur=con.cursor() sqlCmd= """select LastName, FirstName, EmployeeID from Employees where LastName = %(lName)s """ parms = { 'lName': u'Fuller' } cur.execute( sqlCmd, parms ) Traceback (most recent call last): File "/home/carl/tst.py", line 13, in ? cur.execute( sqlCmd, parms ) File "/usr/lib/python2.4/site-packages/pymssql.py", line 126, in execute self.executemany(operation, (params,)) File "/usr/lib/python2.4/site-packages/pymssql.py", line 154, in executemany raise DatabaseError, "internal error: %s" % self.__source.errmsg() pymssql.DatabaseError: internal error: None Remove the u before 'Fuller', the query executes with no error. So, is this to be expected? My guess is that I should be getting some sort of data type mismatch error. Carl K From phd at phd.pp.ru Mon Jan 22 19:21:07 2007 From: phd at phd.pp.ru (Oleg Broytmann) Date: Mon, 22 Jan 2007 21:21:07 +0300 Subject: [DB-SIG] SQLObject 0.7.3b1 Message-ID: <20070122182107.GD8012@phd.pp.ru> Hello! I'm pleased to announce the 0.7.3b1 release 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, and Firebird. It also has newly added support for Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://cheeseshop.python.org/pypi/SQLObject/0.7.3b1 News and changes: http://sqlobject.org/docs/News.html What's New ========== Bug Fixes --------- * Allow multiple MSSQL connections. * Psycopg1 requires port to be a string; psycopg2 requires port to be an int. * Fixed a bug in MSSQLConnection caused by column names being unicode. * Fixed a bug in FirebirdConnection caused by column names having trailing spaces. * Fixed a missed import in firebirdconnection.py. * Remove a leading slash in FirebirdConnection. For a more complete list, please see the news: http://sqlobject.org/docs/News.html Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From phd at phd.pp.ru Mon Jan 22 19:22:59 2007 From: phd at phd.pp.ru (Oleg Broytmann) Date: Mon, 22 Jan 2007 21:22:59 +0300 Subject: [DB-SIG] SQLObject 0.8.0b2 Message-ID: <20070122182259.GG8012@phd.pp.ru> Hello! I'm pleased to announce the 0.8.0b2 release 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, and Firebird. It also has newly added support for 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://cheeseshop.python.org/pypi/SQLObject/0.8.0b2 News and changes: http://sqlobject.org/devel/News.html What's New ========== News since 0.8.0b1 ------------------ * Another round of bugfixes for MySQL errors 2006 and 2013 (SERVER_GONE, SERVER_LOST). * Fixed a bug in MSSQLConnection caused by column names being unicode. * Fixed a bug in FirebirdConnection caused by column names having trailing spaces. * Remove a leading slash in FirebirdConnection. For a more complete list, please see the news: http://sqlobject.org/devel/News.html Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From phd at phd.pp.ru Tue Jan 30 20:58:30 2007 From: phd at phd.pp.ru (Oleg Broytmann) Date: Tue, 30 Jan 2007 22:58:30 +0300 Subject: [DB-SIG] SQLObject 0.7.3 Message-ID: <20070130195830.GC7446@phd.pp.ru> Hello! I'm pleased to announce the 0.7.3 release 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, and Firebird. It also has newly added support for Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://cheeseshop.python.org/pypi/SQLObject/0.7.3 News and changes: http://sqlobject.org/docs/News.html What's New ========== News since 0.7.2 ---------------- Bug Fixes ~~~~~~~~~ * Allow multiple MSSQL connections. * Psycopg1 requires port to be a string; psycopg2 requires port to be an int. * Fixed a bug in MSSQLConnection caused by column names being unicode. * Fixed a bug in FirebirdConnection caused by column names having trailing spaces. * Fixed a missed import in firebirdconnection.py. * Remove a leading slash in FirebirdConnection. * Fixed a bug in deep Inheritance tree. For a more complete list, please see the news: http://sqlobject.org/docs/News.html Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN.