Hi,
I am using Oracle 9i & Python.
The interface is cx_Oracle4.3
I was tryingto fire the following query using this interface: - cursor.execute("""describe employee""")
& got error CHECK YOUR SQL SYNTAX. Although its working fine when i am firing it from SQL*Plus.
Isn't it support this query or I am missing something.
Btw I was using this query to get all the field names & field types.
I got field names using cursor.description command, but it is converting the field type into some other names like VARCHAR2--->STRING.
Kindly guide me.
Thanks & Regards,
Piyush.
5 2821
Hi,
I am using Oracle 9i & Python.
The interface is cx_Oracle4.3
I was tryingto fire the following query using this interface: - cursor.execute("""describe employee""")
& got error CHECK YOUR SQL SYNTAX. Although its working fine when i am firing it from SQL*Plus.
Isn't it support this query or I am missing something.
Btw I was using this query to get all the field names & field types.
I got field names using cursor.description command, but it is converting the field type into some other names like VARCHAR2--->STRING.
Kindly guide me.
Thanks & Regards,
Piyush.
If you post the actuall code, we'll be able to help you spot things like typos and see if you are trying to do something like
which will always be an str type for any character type in python.
If you post the actuall code, we'll be able to help you spot things like typos and see if you are trying to do something like
which will always be an str type for any character type in python.
My code is something like this.. -
import cx_Oracle
-
-
-
#Establishing Connection string using makedsn() function.
-
-
host = 'localhost'
-
port = 1521
-
dbase = 'Sample'
-
login = 'demo'
-
passwrd = 'demo'
-
dsn = cx_Oracle.makedsn(host, port, dbase)
-
connection = cx_Oracle.connect(login, passwrd, dsn)
-
print "********", connection
-
-
cursor = connection.cursor()
-
cursor.arraysize = 50
-
cursor.execute("""describe tab1""")
-
-
-
fields=[]
-
for row in cursor.description:
-
fields.append(row[1])
-
print fields
-
-
I Think this quesry should return tuples equal to total number of fields in the table in the format (field name, field type). But its not working.
My code is something like this.. -
import cx_Oracle
-
-
-
#Establishing Connection string using makedsn() function.
-
-
host = 'localhost'
-
port = 1521
-
dbase = 'Sample'
-
login = 'demo'
-
passwrd = 'demo'
-
dsn = cx_Oracle.makedsn(host, port, dbase)
-
connection = cx_Oracle.connect(login, passwrd, dsn)
-
print "********", connection
-
-
cursor = connection.cursor()
-
cursor.arraysize = 50
-
cursor.execute("""describe tab1""")
-
-
-
fields=[]
-
for row in cursor.description:
-
fields.append(row[1])
-
print fields
-
-
I Think this quesry should return tuples equal to total number of fields in the table in the format (field name, field type). But its not working.
I'll bet you anything (although I don't use oracle, it looks like it comforms to the db api 2.0) the result is in cusrsor.fetchall() not cursor.description.
Use lots of print statements to see what you are getting back (but you knew that, right).
I'll bet you anything (although I don't use oracle, it looks like it comforms to the db api 2.0) the result is in cusrsor.fetchall() not cursor.description.
Use lots of print statements to see what you are getting back (but you knew that, right).
Yes you are right Bartonc, but the interface's compilre is giving arror at the cursor.execure("""describe tab1""") line, its saying check your sql syntax... All the other queries aree running fine except this one.
I am running this to get the field type of the table, this was not working thats y I used cursor.describe method, If u can suggest me any other way for my basic problem( how to get field types using this inteface) then plz tell me.
Thanks.
Yes you are right Bartonc, but the interface's compilre is giving arror at the cursor.execure("""describe tab1""") line, its saying check your sql syntax... All the other queries aree running fine except this one.
I am running this to get the field type of the table, this was not working thats y I used cursor.describe method, If u can suggest me any other way for my basic problem(how to get field types using this inteface) then plz tell me.
Thanks.
A sql syntax error makes this more of an Oracle question. Try asking about the query (not the interface) on the Oracle Forum if you haven't done that already.
but first try Sign in to post your reply or Sign up for a free account.
Similar topics
by: Emile van Sebille |
last post by:
QOTW (advanced interfaces track): "I'm firmly in favour of any language
that can DWIMNWIS." -- Tim Delaney
QOTW (MS roadkill track): "Underestimate MS at your own risk. It is one
thing to not...
|
by: Maxim Kuleshov |
last post by:
Hello!
Trying to fetch long varchar2 column and get the following error:
cx_Oracle.DatabaseError: column at array pos 0 fetched with error: 1406
i.e. string buffer is not much enough to...
|
by: vb_bv |
last post by:
Does Pyton PL/SQL programming language of Oracle support?
Thx
|
by: hot.favorite |
last post by:
Hi,
I'm fairly new to Python so please pardon any dumbness on my part.
I plan to write an app in Python that will run on Linux and would need
to connect to Oracle and MySQL. I could use...
|
by: dananrg |
last post by:
I'm a little confused about what's out there for database modules at:
http://python.org/topics/database/modules.html
What I'd like to do is use Python to access an Oracle 9.X database for...
|
by: cirudinezidane |
last post by:
Hi!!
I'd like to install Oracle 10 g express edition over Ubuntu to use with
Python 2.4. I have installed Ubuntu, Python 2.4 and Oracle database. I
think that I have installed correctly...
|
by: M.-A. Lemburg |
last post by:
On 2008-04-30 18:42, Sean Ryan wrote:
The -v option only causes Python to print more information to
stderr explaining where it is looking for modules.
You should be seeing any dynamic loader...
|
by: Raja |
last post by:
Hi,
I am trying to write a cgi program which would be executed on
browser with Apache server installed.
The program would make a connection to a database using cx_Oracle
module and display...
|
by: harshakusam |
last post by:
Hi All,
In my python script i use to run some oracle queries for this i require a library to connect to oracle which is cx_Oracle.
When we were using 9i(oracle).. my script was running fine.....
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |