I have the following SQL database details:
import sqlalchemy as sch
from config import Config
db_uri = os.environ["SQLALCHEMY_DATABASE_URI"] + os.environ["DB_NAME"]
in the env file I have these
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://*****:*****@instance-amazonaws.com:3306/'
DB_NAME = 'DB_NAME'
Now
db_engine = extrac_db.create_engine(Config.db_uri)
db_connection = db_engine.connect()
When I try this query:
db_connection.execute("select count(*) from table")
query_result = db_connection.fetchall()
It gives the following error:
AttributeError: 'Connection' object has no attribute 'fetchall'
What is the problem here!!!?
2
Answers
Wild guess:
This might work with SQLAlchemy