Skip to main content

flake8-sqlalchemy

PyPI current version Python Support pre-commit.ci status Code style: black

A flake8 plugin for SQLAlchemy code.

Installation

pip install flake8-sqlalchemy

Configuration

By default, all checks are enabled. You can disable all checks by adding the following to your setup.cfg:

[flake8]
ignore = SQA

or ignore specific checks:

[flake8]
ignore = SQA100

SQA100 - sqlalchemy import alias

Checks that when sqlalchemy is imported with an alias, the alias is either sa or db.

Bad

import sqlalchemy as foo

Good

import sqlalchemy as sa
# or
import sqlalchemy as db

SQA200 - Column keyword argument comment required

When writing a Column definition the comment keyword argument is required. This provides inline documentation for the column, as well as generating the SQL to add the comment to the database.

Bad

class Users(Base):
    __tablename__ = "users"

    id = Column(Integer, primary_key=True)
    name = Column(String)

Good

class Users(Base):
    __tablename__ = "users"

    id = Column(Integer, primary_key=True, comment="User ID from Auth Service")
    name = Column(String, comment="User name: first, middle, last")

Also applies to mapped_column:

class Users(Base):
    __tablename__ = "users"

    id = Column(Integer, primary_key=True, comment="User ID from Auth Service")
    name = mapped_column(String, comment="User name: first, middle, last")

License

This project is licensed under the terms of the MIT license. See the LICENSE file for the full license text.

Author

Metadata

Release files for flake8-sqlalchemy 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-sqlalchemy 0.2.0
File Size Uploaded
flake8_sqlalchemy-0.2.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flake8-sqlalchemy 0.2.0
File Interpreter ABI Platform
flake8_sqlalchemy-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / flake8_sqlalchemy-0.2.0.tar.gz

Download URL flake8_sqlalchemy-0.2.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0330865e8ea53c9da581283d960b91bf4716a467672d60a61433cbff202f884d
BLAKE2b-256 checksum
How to use checksums
d8d6fe5646eb1c8e5f0260642128859195e6cc2ff7542356edeccebe90f63ef6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.5 Darwin/22.6.0

Release files / flake8_sqlalchemy-0.2.0-py3-none-any.whl

Download URL flake8_sqlalchemy-0.2.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96c719d560f42857ef24fdb09b97a2e4acffbd40b6795f8bf26c01f2c109d50a
BLAKE2b-256 checksum
How to use checksums
6cf4207e32a090d2304561aec4b39ebcfb8b00bfc22d31ed1f70e91e598c7fd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.5 Darwin/22.6.0

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page