Hi All,
I am trying to get a very simple piece of script to work via Python (Im not sure if this is the right place but please close the thread if its unsuitable)
The script is very simple and works correctly through postgresql
When i try to get this script to work through Python i am getting the error message
Table_A."Event" doesnt exist which is clearly not true as i can execute the previous statement without problems
Below is the python code
Any help would be greatly appreciated
Thank you for your time
I am trying to get a very simple piece of script to work via Python (Im not sure if this is the right place but please close the thread if its unsuitable)
The script is very simple and works correctly through postgresql
Code:
SELECT Table_A."Event"
FROM public.Table_A
WHERE Table_A."Event" = 'Yes';
Table_A."Event" doesnt exist which is clearly not true as i can execute the previous statement without problems
Below is the python code
Any help would be greatly appreciated
Code:
import psycopg2
try:
conn = psycopg2.connect("dbname='Test_DB' user='Test_User' host='localhost' password='FakePWD'")
except:
print "Unable to connect to the database"
SQLstatement =( "SELECT Table_A.""Event"" "
"FROM public.Table_A "
"WHERE Table_A.""Event"" = 'Yes';")
print SQLstatement
# Creates a Cursor which you can set an SQL Statement to and fetches the records
cur = conn.cursor()
cur.execute(SQLstatement)