Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn sqlalchemy logging off completely

sqlalchemy is keep loggin to console even I have the following code

import logging logger = logging.getLogger() logger.disabled = True 

How to turn off sqlalchemy's logging completely?

like image 750
pythoniku Avatar asked Sep 19 '13 17:09

pythoniku


People also ask

Does SQLAlchemy close connection automatically?

connect() method returns a Connection object, and by using it in a Python context manager (e.g. the with: statement) the Connection. close() method is automatically invoked at the end of the block.

What is Create_engine in SQLAlchemy?

The create_engine() method of sqlalchemy library takes in the connection URL and returns a sqlalchemy engine that references both a Dialect and a Pool, which together interpret the DBAPI's module functions as well as the behavior of the database.

What does SQLAlchemy all () return?

As the documentation says, all() returns the result of the query as a list.

Does SQLAlchemy have cursor?

You don't have a cursor in Flask SQLAlchemy because it's an ORM. Methods exist to perform actions on the database directly, unlike packages like SQLite.


1 Answers

Did you pass echo=True to create_engine()? By default it creates StreamHandler which outputs to console. As documentation says, if you didn't provide any echo=True arguments and didn't configure root sqlalchemy logger, it will not log anything.

like image 128
Palasaty Avatar answered Sep 18 '22 18:09

Palasaty