This commit is contained in:
Harrison Chase
2023-02-18 11:49:08 -08:00
committed by GitHub
parent 85c1449a96
commit 45b5640fe5
2 changed files with 69 additions and 65 deletions

View File

@@ -114,15 +114,14 @@ class SQLDatabase:
# save the columns in string format
columns_str = " ".join([col.name for col in table.columns])
# get the sample rows
with self._engine.connect() as connection:
sample_rows = connection.execute(command)
try:
# shorten values in the smaple rows
sample_rows = list(
map(lambda ls: [str(i)[:100] for i in ls], sample_rows)
)
# get the sample rows
with self._engine.connect() as connection:
sample_rows = connection.execute(command)
# shorten values in the sample rows
sample_rows = list(
map(lambda ls: [str(i)[:100] for i in ls], sample_rows)
)
# save the sample rows in string format
sample_rows_str = "\n".join([" ".join(row) for row in sample_rows])