Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

How to get cursor in SQLAlchamy

It's ok in this way.

db = SQLAlchemy(app)
session = db.session()
cursor = session.execute(sql).cursor

Finally got answer from Flask documentation, we can get cursor from db object using,

from sqlalchemy import create_engine
engine = create_engine('your_connection_string')
connection = engine.raw_connection()
cursor = connection.cursor()

Tags:

Python

Cursor

Sqlalchemy

Flask

Flask Sqlalchemy

Related

How to use gettext with python >3.6 f-strings How to make HTTP POST request with url encoded body in flutter? Mockito 2 for Android Instrumentation test : Could not initialize plugin: interface org.mockito.plugins.MockMaker Full Width Material-UI Grid not working as it should Update docker image in Azure Container Instances Add a text suffix to <input type="number"> create-react-app running on Smart TV browser WampServer - mysqld.exe can't start because MSVCR120.dll is missing Angular Material icons not working Why does inheritance behave differently in Java and C++ with superclasses calling (or not) subclasses' methods? TypeError: Object of type 'int32' is not JSON serializable AWS Lambda Logs using AWSCLI: How can I access Lambda logs using AWSCLI?

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy