Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Provides a simple way to find slow SQL queries when using SQLAlchemy.
Hooks into the SQLAlchemy events system to find when queries start and finish. Note that this is not meant to serve as a profiler and will not explain why your queries are slow, just tell you which ones are. See SQLAlchemy docs about performance for profiling if you need to find out how much time a query spends waiting for database response, fetching the data and ORM operations.
This is a pure python package, so it can be installed with pip install simple-sqla-timer
or any other dependency manager.
Run this function at the start of your application:
from simple_sqla_timer import setup_query_timer
setup_query_timer()
By default, this will log the start of the statements and their durations to the simple_sqla_timer
logger, with
debug
level. You can override this behaviour by specifying a custom logging function:
import logging
from simple_sqla_timer import setup_query_timer
def my_log_function(statement: str, duration: float) -> None:
logging.info("Query: %s\nDuration:%f", statement, duration)
setup_query_timer(my_log_function)
Important: The query timer must be set up before the application opens SQLAlchemy Engine
connections. Any
connections opened before setting up the timer will not have their statements logged.
This library uses the poetry package manager, which has to be installed before installing
other dependencies. Afterwards, run poetry install
to create a virtualenv and install all dependencies.
Black is used (and enforced via workflows) to format all code. Poetry will install it
automatically, but running it is up to the user. To format the entire project, run black .
.
This project uses the Apache 2.0 license and is maintained by the data science team @ Barbora. All contributions are welcome in the form of PRs or raised issues.
FAQs
A simple way of logging how long it takes for SQLAlchemy queries to run.
We found that simple-sqla-timer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.