mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 13:07:58 +00:00
SQLDatabase drop the column names in the result. (#15361)
Fix for the following bug: https://github.com/langchain-ai/langchain/issues/15360 --------- Co-authored-by: dudu butbul <100126964+dudu-upstream@users.noreply.github.com>
This commit is contained in:
@@ -120,10 +120,16 @@ def test_sql_database_run() -> None:
|
||||
conn.execute(stmt)
|
||||
db = SQLDatabase(engine)
|
||||
command = "select user_id, user_name, user_bio from user where user_id = 13"
|
||||
output = db.run(command)
|
||||
partial_output = db.run(command)
|
||||
user_bio = "That is my Bio " * 19 + "That is my..."
|
||||
expected_output = f"[(13, 'Harrison', '{user_bio}')]"
|
||||
assert output == expected_output
|
||||
expected_partial_output = f"[(13, 'Harrison', '{user_bio}')]"
|
||||
assert partial_output == expected_partial_output
|
||||
|
||||
full_output = db.run(command, include_columns=True)
|
||||
expected_full_output = (
|
||||
"[{'user_id': 13, 'user_name': 'Harrison', 'user_bio': '%s'}]" % user_bio
|
||||
)
|
||||
assert full_output == expected_full_output
|
||||
|
||||
|
||||
def test_sql_database_run_update() -> None:
|
||||
|
Reference in New Issue
Block a user