ok this is interesting. I put a line in engine.py ResultProxy to see what happens, which just prints out the column name it gets back from cursor.description.

In most of the test suite queries, it is querying using "AS", such as "SELECT foo.bar AS foo_bar FROM foo", so that might explain why the unittests are passing. but anyway, mine gets the correct column names back from the result, i.e. without the tablename.

what version of sqlite are you on ?  Im on 3.2.7.

I suppose whether or not we identify what causes the problem, the solution would be to take the incoming column name and just remove left of the period. So this patch will correct for that and also show the "before" and "after" for each column. give it a try:

--- engine.py   (revision 657)
+++ engine.py   (working copy)
@@ -333,12 +333,14 @@
         i = 0
         if metadata is not None:
             for item in metadata:
+                colname = item[0].split('.')[-1].lower()
+                print "METADATA", item[0], colname
                 if typemap is not None:
-                    rec = (typemap.get(item[0], types.NULLTYPE), i)
+                    rec = (typemap.get(colname, types.NULLTYPE), i)
                 else:
                     rec = (types.NULLTYPE, i)
- if self.props.setdefault(item[0].lower(), rec) is not rec: - self.props[item[0].lower()] = (ResultProxy.AmbiguousColumn(item[0].lower()), 0)
+                if self.props.setdefault(colname, rec) is not rec:
+ self.props[colname] = (ResultProxy.AmbiguousColumn(colname), 0)
                 self.props[i] = rec
                 i+=1

let me know if that fixes it.

On Nov 27, 2005, at 5:10 PM, Robert Leftwich wrote:

Michael Bayer wrote:
try turning on echo=True when you make the DBengine, it will show you all the queries as well as their results sent to standard out. its *possible* that something goes wrong with the toengine() call with sqlite, try hardcoding your engines to a plain sqlite engine, i.e. dont use a non-sqlite engine at all, and see if that fixes it.

It happens even with a hard-coded sqlite engine. All the select queries are prefixed with the table name, e.g. 'select foo.id, foo.col1...' for both postgres and sqlite, but the cursor.description used in the ResultProxy constructor is different, i.e. sqlite's metadata has the table name prepended to the column name in item[0].

Is this a version issue - I'm using the latest pysqlite (2.0.5) and psycopg v2.0b1? (although that doesn't explain why the SQLAlchemy unit tests are working).

Robert



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to