sqlalchemy-views
Adds CreateView and DropView constructs to SQLAlchemy
What it is and what it does
sqlalchemy-views extends SQLAlchemy with two new SQL constructs—CreateView and DropView—that let you define and manipulate database views using SQLAlchemy's expression API instead of raw SQL strings. It wraps the view definition (typically a SELECT statement) and compiles it to the appropriate CREATE VIEW or DROP VIEW SQL for execution.
The package is designed for developers who want to manage views programmatically within SQLAlchemy applications, supporting common options like OR REPLACE, IF EXISTS, CASCADE, and dialect-specific view options. It relies entirely on sqlalchemy as its runtime dependency and has remained stable because it builds on SQLAlchemy's core, stable APIs rather than internal details.
Use it for:
- Define database views in Python code alongside table definitions for schema migrations and setup scripts
- Conditionally create or replace views with OR REPLACE or IF EXISTS flags in application initialization
- Drop views safely with CASCADE when cleaning up or resetting a database schema
- Introspect existing views using SQLAlchemy's Table object and regenerate their definitions programmatically
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds CreateView and DropView SQL constructs to SQLAlchemy, enabling programmatic creation and removal of database views through SQLAlchemy's expression language.
Yes, if you need to manage database views within SQLAlchemy code. The package is small, stable, and has no known vulnerabilities. Install friction is minimal (one dependency). The main caveat is that it supports only a core subset of SQL dialects—if your database uses nonstandard CREATE/DROP VIEW syntax, you may need to fall back to raw SQL or check whether your dialect is covered.
Install
sqlalchemy-views on PyPI
pip
pip install sqlalchemy-viewsuv
uv add sqlalchemy-viewspoetry
poetry add sqlalchemy-viewsInstalling sqlalchemy-views
Before you install
Low friction install with a single runtime dependency on sqlalchemy. The codebase is small and stable; maintenance has been minimal since early 2023 because it relies on stable SQLAlchemy APIs. Repository remains active with recent commits.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute this package freely with minimal restrictions.
Quickstart
pip install sqlalchemy-views
from sqlalchemy import Table, MetaData
from sqlalchemy.sql import text
from sqlalchemy_views import CreateView, DropView
view = Table('my_view', MetaData())
definition = text("SELECT * FROM my_table")
create_view = CreateView(view, definition)
print(str(create_view.compile()).strip())
Verify before relying
- Whether the package supports all major SQL dialects or only a core subset of CREATE/DROP VIEW syntax
- Current compatibility with SQLAlchemy 2.0 beyond the stated 'early 2023' snapshot
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — sqlalchemy |
| Maintenance | actively maintained — 1,273 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 150,750/month — #10,955 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sqlalchemy_views-0.3.2-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
django-pgviews-reduxAdds first-class PostgreSQL view support to…
unclear · top 15,000 on PyPI
SQLAlchemySQLAlchemy is a Python SQL toolkit and Object…
permissive · top 100 on PyPI
alembic_utilsExtends Alembic to autogenerate database…
permissive · top 5,000 on PyPI
schemainspectInspects PostgreSQL database schemas to extract…
permissive · top 15,000 on PyPI
teradatasqlalchemyProvides a SQLAlchemy dialect that enables…
unclear · top 5,000 on PyPI
sqlbagsqlbag provides a collection of SQLAlchemy…
unclear · top 15,000 on PyPI
django-adminplusAdds custom admin views to Django's admin…
permissive · top 5,000 on PyPI
iomete-sqlalchemyProvides a SQLAlchemy dialect for connecting to…
permissive · top 15,000 on PyPI
sqlalchemy-verticaProvides a SQLAlchemy dialect for Vertica,…
permissive · top 15,000 on PyPI
databricks-sqlalchemyProvides a SQLAlchemy 2.0 dialect that bridges…
permissive · top 1,000 on PyPI