[cx-oracle-users] cursor.description, functions, and comments -- bug?
Brought to you by:
atuining
|
From: Milt E. <mep...@il...> - 2014-07-03 20:03:19
|
I'm using cx_Oracle and I'm having an issue with cursor.description
and what seems to be a combination of using an aggregating function
and a comment in the SQL. My query looks like this:
SELECT ETL_CHAIN, max(COMPLETION_DT)
-- SELECT *
FROM ...
...
The query is actually stored in a file and I'm reading it in before
running it (I'm just mentioning that -- I don't think there's any
issue with it, since it works fine in other cases). As you can see,
there's a line commented out in the query.
Now when I use cursor.description to get info about the columns of the
query results, this is what is returned:
('ETL_CHAIN', <class 'cx_Oracle.STRING'>, 30, 30, 0, 0, 0)
('MAX(COMPLETION_DT)--SELECT*', <class 'cx_Oracle.DATETIME'>, 23, 7, 0, 0, 1)
As you can see, the name of the second column has the comment line
appended to it (with the newline and spaces removed). This problem
goes away and the column name is fine if, say, I switch the first two
lines of the above query (so the comment appears first) or I don't use
the function. It's also OK if I add an AS to the SELECT. (So there
are workarounds, but ...)
Any ideas what's going on? Is this a bug? It seems as if some extra
processing is being done on the column name, and in this particular
case, it's not working right.
Thanks.
Milt Epstein
Applications Developer
Graduate School of Library and Information Science (GSLIS)
University of Illinois at Urbana-Champaign (UIUC)
mep...@il...
|