themissingCRAM
commited on
Commit
·
1a788a2
1
Parent(s):
71a1eda
debug
Browse files
app.py
CHANGED
|
@@ -42,7 +42,7 @@ def sql_engine_tool(query: str, engine: any) -> str:
|
|
| 42 |
|
| 43 |
Args:
|
| 44 |
query: The query to perform. This should be correct SQL.
|
| 45 |
-
engine: just use
|
| 46 |
"""
|
| 47 |
output = ""
|
| 48 |
print("debug sql_engine_tool")
|
|
@@ -50,6 +50,13 @@ def sql_engine_tool(query: str, engine: any) -> str:
|
|
| 50 |
with engine.connect() as con:
|
| 51 |
print(con.connection)
|
| 52 |
print(metadata_objects.tables.keys())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
rows = con.execute(text(query))
|
| 54 |
for row in rows:
|
| 55 |
output += "\n" + str(row)
|
|
|
|
| 42 |
|
| 43 |
Args:
|
| 44 |
query: The query to perform. This should be correct SQL.
|
| 45 |
+
engine: just use engine object as declared later
|
| 46 |
"""
|
| 47 |
output = ""
|
| 48 |
print("debug sql_engine_tool")
|
|
|
|
| 50 |
with engine.connect() as con:
|
| 51 |
print(con.connection)
|
| 52 |
print(metadata_objects.tables.keys())
|
| 53 |
+
result = con.execute(
|
| 54 |
+
text(
|
| 55 |
+
"SELECT name FROM sqlite_master WHERE type='table' AND name='receipts'"
|
| 56 |
+
)
|
| 57 |
+
)
|
| 58 |
+
print("tables available:", result.fetchone())
|
| 59 |
+
|
| 60 |
rows = con.execute(text(query))
|
| 61 |
for row in rows:
|
| 62 |
output += "\n" + str(row)
|