# Execute query and fetch results into a DataFrame
df = pd.read_sql(sql_query, conn)
# Check if the DataFrame is empty
if df.empty:
print("The result set is empty.")
else:
print("The result set is not empty.")
# Process the DataFrame (example)
print(df)
# Close connection
conn.close()
No comments:
Post a Comment