When I execute query "DESCRIBE ARADMIN.EPM_TechnicianInformation" like below:
connection = cx_Oracle.connect(user=username, password=userpwd, dsn=dsn, encoding="UTF-8")
cursor = connection.cursor()
results = cursor.execute(" DESCRIBE ARADMIN.EPM_TechnicianInformation")
It is giving
DatabaseError: ORA-00900: invalid SQL statement
How can I create query "DESCRIBE ARADMIN.EPM_TechnicianInformation" with cx_Oracle? I want to get column details of the table.
Please help! Thanks!
The 'desc' command is a SQL*Plus command, not something the database or cx_Oracle understands.
Please check the documentation on cursor description property of cx_Oracle.
You can try the following:
# sql for column details
sql = "SELECT * from ARADMIN.EPM_TechnicianInformation"
cursor.execute(sql)
print(cursor.description)
# This will print out the column description as a list, with each item referring to each column.