juancamval commited on
Commit
0522a90
·
verified ·
1 Parent(s): dd7bed1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -6
app.py CHANGED
@@ -47,14 +47,30 @@ def load_data():
47
 
48
  """fertility, geo data, labor, population y predictions """
49
  try:
50
- response = supabase.from_("labor").select("*").execute()
51
- if response.error:
52
- st.error(f"Error fetching data: {response.error}")
53
- return pd.DataFrame()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  else:
55
- return pd.DataFrame(response.data)
 
56
  except Exception as e:
57
- st.error(f"An error occurred: {e}")
58
  return pd.DataFrame()
59
 
60
 
 
47
 
48
  """fertility, geo data, labor, population y predictions """
49
  try:
50
+ if supabase:
51
+ response = supabase.from_("YourTableName").select("*").execute()
52
+ print(f"Response object: {response}") # Inspect the entire response
53
+ print(f"Response type: {type(response)}") # Check the object type
54
+
55
+ # Try accessing potential error-related attributes
56
+ if hasattr(response, 'data'):
57
+ print(f"Response data: {response.data}")
58
+ return pd.DataFrame(response.data)
59
+ elif hasattr(response, 'status_code'):
60
+ print(f"Response status code: {response.status_code}")
61
+ elif hasattr(response, '_error'): # Older versions might use this
62
+ print(f"Older error attribute: {response._error}")
63
+ st.error(f"Error fetching data: {response._error}")
64
+ return pd.DataFrame()
65
+ else:
66
+ st.info("Response object does not have 'data' or known error attributes. Check the logs.")
67
+ return pd.DataFrame()
68
+
69
  else:
70
+ st.error("Supabase client not initialized. Check environment variables.")
71
+ return pd.DataFrame()
72
  except Exception as e:
73
+ st.error(f"An error occurred during data loading: {e}")
74
  return pd.DataFrame()
75
 
76