--- id: sqlalchemy-views version: "0.3.2" license: unclear license_treatment: permissive maintenance: active --- # sqlalchemy-views — Adds CreateView and DropView constructs to SQLAlchemy License: permissive · Maintenance: active · Downloads: 150.8K/mo ## 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 above — 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 pip install sqlalchemy-views uv add sqlalchemy-views poetry add sqlalchemy-views ## Installing 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: unspecified - Install friction: low - Maintenance: active - Downloads: 150.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sqlalchemy view creation, database view management, create drop view sqlalchemy, sql view constructs, sqlalchemy database views, sqlalchemy-extension, schema-management [View on SkillFed](https://skillfed.io/packages/sqlalchemy-views) · [View on PyPI](https://pypi.org/project/sqlalchemy-views/)