Spaces:
Running
Running
add ssl mode
Browse files
app.py
CHANGED
@@ -19,14 +19,15 @@ def get_data():
|
|
19 |
port=DB_PORT,
|
20 |
dbname=DB_NAME,
|
21 |
user=DB_USER,
|
22 |
-
password=DB_PASSWORD
|
|
|
23 |
)
|
24 |
query = "SELECT country, year, section, question_code, question_text, answer_code, answer_text FROM survey_info;"
|
25 |
df = pd.read_sql_query(query, conn)
|
26 |
conn.close()
|
27 |
return df
|
28 |
except Exception as e:
|
29 |
-
st.error("Failed to connect to the database
|
30 |
st.stop()
|
31 |
|
32 |
# Load data
|
|
|
19 |
port=DB_PORT,
|
20 |
dbname=DB_NAME,
|
21 |
user=DB_USER,
|
22 |
+
password=DB_PASSWORD,
|
23 |
+
ssl_mode="require"
|
24 |
)
|
25 |
query = "SELECT country, year, section, question_code, question_text, answer_code, answer_text FROM survey_info;"
|
26 |
df = pd.read_sql_query(query, conn)
|
27 |
conn.close()
|
28 |
return df
|
29 |
except Exception as e:
|
30 |
+
st.error("Failed to connect to the database: {e}")
|
31 |
st.stop()
|
32 |
|
33 |
# Load data
|