import streamlit
import pandas as pd
import snowflake.connector
streamlit.title('Citibike station')
my_cnx = snowflake.connector.connect(**streamlit.secrets["snowflake"])
my_cur = my_cnx.cursor()
my_cur.execute("select legacy_id from citibike_status") <-- error
my_catalog = my_cur.fetchall()
df = pd.DataFrame(my_catalog) streamlit.write(df)
if I try * it fetches all the data but when I mention any of the col names it says it's invalid.
CodePudding user response:
Most likely it was quoted during table creation and should be accessed as such:
select "legacy_id" from citibike_status
In Python:
my_cur.execute("""select "legacy_id" from citibike_status""")
If an object is created using a double-quoted identifier, when referenced in a query or any other SQL statement, the identifier must be specified exactly as created, including the double quotes. Failure to include the quotes might result in an Object does not exist error (or similar type of error).