-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
How to get value from sqlalchemy .execute() method? Python + Sqlalchemy+ MS SQL server #5434
Copy link
Copy link
Closed
Labels
questionissue where a "fix" on the SQLAlchemy side is unlikely, hence more of a usage questionissue where a "fix" on the SQLAlchemy side is unlikely, hence more of a usage question
Description
Hi wrote a method to get the status of a csv file in a sql server table. The table has column named CSV_STATUS, and for the particular csv, I'd like my method to give me the value of the CSV status. I wrote the following function:
def return_csv_status_db(db_instance, name_of_db_instance_tabledict, csvfile_path):
table_dict = db_instance[name_of_db_instance_tabledict]
csvfile_name = csvfile_path.name
sql = db.select([table_dict['table'].c.CSV_STATUS]).where(table_dict['table'].c.CSV_FILENAME == csvfile_name)
result = table_dict['engine'].execute(sql)
print(result)
Whenever I print result, it returns: <sqlalchemy.engine.result.ResultProxy object at 0x0000005E642256C8> How can I extract the value of the select statement?
Versions
- OS: Windows Server 2012
- Python: 3.6
- SQLAlchemy: Not sure. Latest one?
- Database: SQL Server 2017
- DBAPI: Not sure, default?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionissue where a "fix" on the SQLAlchemy side is unlikely, hence more of a usage questionissue where a "fix" on the SQLAlchemy side is unlikely, hence more of a usage question