botsi commited on
Commit
37c9d9d
·
verified ·
1 Parent(s): bdce154

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -95,27 +95,6 @@ def fetch_personalized_data():
95
  """
96
  cursor.execute(query)
97
 
98
- # Fetch the results
99
- results = cursor.fetchall()
100
-
101
- # Process the results as needed
102
- for row in results:
103
- print(row)
104
-
105
- # Close the cursor and connection when done
106
- cursor.close()
107
- conn.close()
108
-
109
- return results
110
-
111
- # Call the function to fetch data as JSON
112
- personalized_data = fetch_personalized_data()
113
-
114
- # Print or use the json_result variable as needed
115
- print(personalized_data)
116
-
117
-
118
- '''
119
  # Fetch all rows and convert to a list of dictionaries
120
  rows = cursor.fetchall()
121
  result = []
@@ -126,13 +105,34 @@ print(personalized_data)
126
  result.append(d)
127
 
128
  # Convert the list of dictionaries to JSON
129
- json_result = json.dumps(result)
130
 
131
  # Close the database connection
132
  conn.close()
133
 
134
  # Return the JSON result
135
- return json_result
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  '''
137
 
138
 
 
95
  """
96
  cursor.execute(query)
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  # Fetch all rows and convert to a list of dictionaries
99
  rows = cursor.fetchall()
100
  result = []
 
105
  result.append(d)
106
 
107
  # Convert the list of dictionaries to JSON
108
+ personalized_result = json.dumps(result)
109
 
110
  # Close the database connection
111
  conn.close()
112
 
113
  # Return the JSON result
114
+ return personalized_result
115
+
116
+ # Call the function to fetch data as JSON
117
+ personalized_data = fetch_personalized_data()
118
+
119
+ # Print or use the json_result variable as needed
120
+ print(personalized_data)
121
+
122
+
123
+ '''
124
+ # Fetch the results
125
+ results = cursor.fetchall()
126
+
127
+ # Process the results as needed
128
+ for row in results:
129
+ print(row)
130
+
131
+ # Close the cursor and connection when done
132
+ cursor.close()
133
+ conn.close()
134
+
135
+ return results
136
  '''
137
 
138