├── .gitignore ├── README.rst └── _.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.json 2 | .*.swp 3 | .idea/ 4 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Awesome SQLAlchemy 2 | ================== 3 | 4 | .. image:: https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg 5 | :target: https://github.com/sindresorhus/awesome 6 | 7 | A curated list of awesome extra libraries and resources for SQLAlchemy_. Inspired by 8 | awesome-python_. (See also other `awesome lists`__!) 9 | 10 | Licensed under a `Creative Commons Attribution-ShareAlike 4.0 International 11 | License`__. 12 | 13 | .. _SQLAlchemy: https://www.sqlalchemy.org/ 14 | .. _awesome-python: https://github.com/vinta/awesome-python 15 | __ https://github.com/sindresorhus/awesome 16 | __ https://creativecommons.org/licenses/by-sa/4.0/ 17 | 18 | .. contents:: Table of Contents 19 | :backlinks: none 20 | :depth: 3 21 | 22 | 23 | Data Structures 24 | --------------- 25 | 26 | SQLAlchemy-Continuum_ 27 | Versioning and auditing extension for SQLAlchemy. 28 | 29 | - Creates versions for inserts, deletes and updates. 30 | - Does not store updates which don't change anything. 31 | - Supports alembic migrations. 32 | - Can revert objects data as well as all object relations at given 33 | transaction even if the object was deleted. 34 | - Transactions can be queried afterwards using SQLAlchemy query syntax. 35 | - Query for changed records at given transaction. 36 | - Temporal relationship reflection. Version object's relationship show 37 | the parent objects relationships as they where in that point in time. 38 | - Supports native versioning for PostgreSQL database (trigger based 39 | versioning). 40 | 41 | sqlalchemy_mptt_ 42 | Library for implementing MPTT (modified preorder tree traversal) with 43 | SQLAlchemy models and working with trees of model instances, 44 | like django-mptt_. 45 | 46 | SQLAlchemy-ORM-tree_ 47 | An implementation for SQLAlchemy-based applications of 48 | the nested-sets/modified-pre-order-tree-traversal technique for 49 | storing hierarchical data in a relational database. 50 | 51 | vdm_ 52 | Versioned domain model. Python library for revisioning/versioning of databases. 53 | 54 | .. _django-mptt: https://github.com/django-mptt/django-mptt/ 55 | .. _SQLAlchemy-Continuum: https://sqlalchemy-continuum.readthedocs.io/ 56 | .. _sqlalchemy_mptt: https://sqlalchemy-mptt.readthedocs.io/ 57 | .. _SQLAlchemy-ORM-tree: https://sqlalchemy-orm-tree.readthedocs.io/ 58 | .. _vdm: https://github.com/okfn/vdm 59 | 60 | 61 | Data Types 62 | ---------- 63 | 64 | SQLAlchemy-Enum34_ 65 | SQLAlchemy type to store standard ``enum.Enum`` values. 66 | 67 | SQLAlchemy-Utc_ 68 | SQLAlchemy type to store aware ``datetime.datetime`` values. 69 | 70 | SQLAlchemy-Utils_ 71 | Various utility functions, new data types and helpers for SQLAlchemy 72 | 73 | - Listeners 74 | - Data types: {..., ChoiceType, CountryType, JSONType, URLType, UUIDType, ...} 75 | - Range data types 76 | - Aggregated attributes 77 | - Generates decorator 78 | - Generic relationships 79 | - Database helpers: create_database, drop_database 80 | - Foreign key helpers 81 | - ORM helpers 82 | - Utility classes 83 | - Model mixins: Timestamp (created, updated times) 84 | 85 | .. _SQLAlchemy-Enum34: https://github.com/spoqa/sqlalchemy-enum34 86 | .. _SQLAlchemy-Utc: https://github.com/spoqa/sqlalchemy-utc 87 | .. _SQLAlchemy-Utils: https://sqlalchemy-utils.readthedocs.io/ 88 | 89 | 90 | Database Migration Tools 91 | ------------------------ 92 | 93 | Alembic_ 94 | Alembic is a lightweight database migration tool for usage with the 95 | SQLAlchemy Database Toolkit for Python. 96 | 97 | sqlalchemy-migrate_ 98 | Inspired by Ruby on Rails' migrations, SQLAlchemy Migrate provides 99 | a way to deal with database schema changes in SQLAlchemy projects. 100 | 101 | .. _Alembic: https://alembic.readthedocs.io/ 102 | .. _sqlalchemy-migrate: https://sqlalchemy-migrate.readthedocs.io/ 103 | 104 | 105 | Dialects 106 | -------- 107 | 108 | https://docs.sqlalchemy.org/en/latest/dialects/ 109 | 110 | redshift_sqlalchemy_ 111 | `Amazon Redshift`_ dialect for SQLAlchemy. 112 | 113 | sphinxalchemy_ 114 | SQLAlchemy dialect for interfacing with Sphinx_ (search engine) via 115 | SphinxQL. 116 | 117 | GINO_ 118 | An asynchronous PostgreSQL dialect for asyncpg_, providing SQLAlchemy 119 | core support and its own asynchronous ORM interface. 120 | 121 | .. _Amazon Redshift: https://aws.amazon.com/redshift/ 122 | .. _redshift_sqlalchemy: https://github.com/binarydud/redshift_sqlalchemy 123 | .. _Sphinx: https://sphinxsearch.com/ 124 | .. _sphinxalchemy: https://sphinxalchemy.readthedocs.io/ 125 | .. _GINO: https://github.com/python-gino/gino 126 | .. _asyncpg: https://github.com/MagicStack/asyncpg 127 | 128 | 129 | Documentation 130 | ------------- 131 | 132 | * https://docs.sqlalchemy.org/en/latest/ 133 | * https://docs.sqlalchemy.org/en/latest/intro.html 134 | * https://docs.sqlalchemy.org/en/latest/core/tutorial.html 135 | * https://docs.sqlalchemy.org/en/latest/orm/tutorial.html 136 | * https://docs.sqlalchemy.org/en/latest/glossary.html 137 | 138 | 139 | File and Image Attachments 140 | -------------------------- 141 | 142 | filedepot_ 143 | DEPOT is a framework for easily storing and serving files in web 144 | applications. Depot features simple integration with SQLAlchemy by providing 145 | customized model field types for storing files attached to your ORM 146 | document. 147 | 148 | SQLAlchemy-ImageAttach_ 149 | SQLAlchemy-ImageAttach is a SQLAlchemy extension for attaching images 150 | to entity objects. 151 | 152 | sqlalchemy-media_ 153 | Based on `SQLAlchemy-ImageAttach` but using JSON type instead of relation, 154 | and SqlAlchemy's mutable facility, Also supports multiple stores per context. 155 | 156 | .. _filedepot: https://depot.readthedocs.io/ 157 | .. _SQLAlchemy-ImageAttach: https://sqlalchemy-imageattach.readthedocs.io/ 158 | .. _sqlalchemy-media: https://github.com/pylover/sqlalchemy-media 159 | 160 | 161 | Forms and Data Validations 162 | -------------------------- 163 | 164 | ColanderAlchemy_ 165 | ColanderAlchemy helps you to auto-generate Colander_ schemas that are based 166 | on SQLAlchemy mapped classes. 167 | 168 | Such Colander schemas can be used with libraries like Deform_ and helps 169 | remove the need for duplication of schema definitions. 170 | 171 | Flask-Validator_ 172 | Data validator for Flask and SQL-Alchemy, working at Model component 173 | with events, preventing invalid data in the columns. 174 | The extension works with event listeners from SQLAlchemy. 175 | 176 | FormAlchemy_ 177 | FormAlchemy eliminates boilerplate by autogenerating HTML input fields from a 178 | given model. FormAlchemy will try to figure out what kind of HTML code should 179 | be returned by introspecting the model's properties and generate ready-to-use 180 | HTML code that will fit the developer's application. 181 | 182 | WTForms-Alchemy_ 183 | WTForms-Alchemy is a WTForms_ extension toolkit for easier creation of 184 | model based forms. Strongly influenced by Django ModelForm. 185 | 186 | Sprox_ 187 | Sprox provides an easy way to create forms for web content which are: 188 | automatically generated, easy to customize, and validated. Sprox also 189 | has powerful tools to help you display your content the way you want 190 | to with table and record viewers. Sprox provides a way to fill your 191 | widgets, whether they are forms or other content with customizable data. 192 | 193 | 194 | .. _Colander: https://docs.pylonsproject.org/projects/colander/ 195 | .. _ColanderAlchemy: https://github.com/stefanofontanelli/ColanderAlchemy 196 | .. _Deform: https://docs.pylonsproject.org/projects/deform/ 197 | .. _Flask-Validator: https://flask-validator.readthedocs.io/ 198 | .. _FormAlchemy: https://github.com/FormAlchemy/formalchemy 199 | .. _WTForms: https://wtforms.readthedocs.io/ 200 | .. _WTForms-Alchemy: https://wtforms-alchemy.readthedocs.io/ 201 | .. _Sprox: https://sprox.org/ 202 | 203 | 204 | Full-text Searching 205 | ------------------- 206 | 207 | SQLAlchemy-Searchable_ 208 | Full-text searchable models for SQLAlchemy. Only supports PostgreSQL. 209 | 210 | .. _SQLAlchemy-Searchable: https://sqlalchemy-searchable.readthedocs.io/ 211 | 212 | SQLAlchemy-FullText-Search_ 213 | Fulltext search support with MySQL & SQLAlchemy. 214 | 215 | .. _SQLAlchemy-FullText-Search: https://github.com/mengzhuo/sqlalchemy-fulltext-search 216 | 217 | 218 | GIS and Spatial Databases 219 | ------------------------- 220 | 221 | GeoAlchemy_ 222 | GeoAlchemy provides extensions to SQLAlchemy to work with spatial databases. 223 | 224 | The current supported spatial database systems are PostGIS_, Spatialite_, 225 | MySQL, Oracle, and MS SQL Server 2008. 226 | 227 | `GeoAlchemy 2`_ 228 | GeoAlchemy 2 provides extensions to SQLAlchemy for working with 229 | spatial databases. 230 | 231 | GeoAlchemy 2 focuses on PostGIS_. PostGIS 1.5 and PostGIS 2 are supported. 232 | Spatialite_ is also supported, but using GeoAlchemy 2 with Spatialite 233 | requires some specific configuration on the application side. 234 | 235 | GeoAlchemy 2 aims to be simpler than its predecessor, GeoAlchemy_. 236 | Simpler to use, and simpler to maintain. 237 | 238 | .. _GeoAlchemy: https://geoalchemy.readthedocs.io/ 239 | .. _GeoAlchemy 2: https://geoalchemy-2.readthedocs.io/ 240 | .. _PostGIS: https://postgis.net/ 241 | .. _Spatialite: https://www.gaia-gis.it/gaia-sins/ 242 | 243 | 244 | Internationalizations 245 | --------------------- 246 | 247 | SQLAlchemy-i18n_ 248 | Internationalization extension for SQLAlchemy models. 249 | 250 | 251 | - Stores translations in separate tables. 252 | - Reflects translation table structures based on 253 | parent model table structure. 254 | - Supports forcing of given locale. 255 | - Good performance (uses proxy dicts and other advanced SQLAlchemy 256 | concepts for performance optimization). 257 | 258 | .. _SQLAlchemy-i18n: https://sqlalchemy-i18n.readthedocs.io/ 259 | 260 | 261 | Profilers 262 | --------- 263 | 264 | flask_debugtoolbar_ 265 | Debug toolbar with SQLAlchemy query information for Flask. 266 | 267 | pyramid_debugtoolbar_ 268 | Debug toolbar with SQLAlchemy query information for Pyramid. 269 | 270 | SQLTap_ 271 | SQLTap is a library that allows you to profile and introspect the queries 272 | that your application makes using SQLAlchemy. 273 | 274 | SQLTap helps you understand: 275 | 276 | - how many times a sql query is executed 277 | - how much time your sql queries take 278 | - where your application is issuing sql queries from 279 | 280 | nplusone_ 281 | Auto-detect the n+1 queries problem in SQLAlchemy (and other Python ORMs) 282 | 283 | nplusone detects unnecessary queries caused by lazy loading and unused eager loading. 284 | Integrates with Flask-SQLAlchemy. 285 | 286 | .. _flask_debugtoolbar: https://github.com/flask-debugtoolbar/flask-debugtoolbar 287 | .. _pyramid_debugtoolbar: https://github.com/Pylons/pyramid_debugtoolbar 288 | .. _SQLTap: https://github.com/inconshreveable/sqltap 289 | .. _nplusone: https://github.com/jmcarp/nplusone 290 | 291 | 292 | Query helpers 293 | ------------- 294 | 295 | sqlakeyset_ 296 | This library implements keyset-based paging for SQLAlchemy (both ORM and core). 297 | 298 | This library has been tested with PostgreSQL and MariaDB/MySQL. 299 | It should work with other SQLAlchemy-supported databases to provided they support ``row(`` syntax. 300 | 301 | .. _sqlakeyset: https://github.com/djrobstep/sqlakeyset 302 | 303 | 304 | Recipes 305 | ------- 306 | 307 | * https://github.com/sqlalchemy/sqlalchemy/wiki/UsageRecipes 308 | 309 | 310 | Serialization and deserialization 311 | --------------------------------- 312 | 313 | marshmallow-sqlalchemy_ 314 | SQLAlchemy integration with the marshmallow_ (de)serialization library. 315 | 316 | pydantic_ 317 | Data parsing and validation using Python type hints 318 | 319 | sqlalchemy-dict_ 320 | SQLAlchemy extension for interacting models with python dictionary. 321 | 322 | .. _marshmallow: https://marshmallow.readthedocs.io/ 323 | .. _marshmallow-sqlalchemy: https://marshmallow-sqlalchemy.readthedocs.io/ 324 | .. _pydantic: https://github.com/samuelcolvin/pydantic 325 | .. _sqlalchemy-dict: https://github.com/meyt/sqlalchemy-dict 326 | 327 | 328 | Testing 329 | ------- 330 | 331 | charlatan_ 332 | Fixtures management for SQLAlchemy and other systems. 333 | 334 | factory_boy_ 335 | Generate fake data and create random fixtures for testing in SQLAlchemy 336 | and many other Python ORM systems. 337 | 338 | mixer_ 339 | Generate fake data and create random fixtures for testing in SQLAlchemy 340 | and many other Python ORM systems. 341 | 342 | 343 | .. _charlatan: https://github.com/uber/charlatan 344 | .. _factory_boy: https://github.com/FactoryBoy/factory_boy 345 | .. _mixer: https://github.com/klen/mixer 346 | 347 | 348 | Thin Abstractions 349 | ----------------- 350 | 351 | Dataset_ 352 | Easy-to-use data handling for SQL data stores in Python with support for 353 | implicit table creation, bulk loading, and transaction. Dataset also 354 | includes support for freezing data to CSV and JSON flat files. 355 | 356 | rdflib-sqlalchemy_ 357 | RDFLib_ store using SQLAlchemy dbapi as back-end. 358 | 359 | PugSQL_ 360 | Loading and execution of parameterized queries stored in files. 361 | 362 | SQLSoup_ 363 | SQLSoup provides a convenient way to map Python objects to 364 | relational database tables, with no declarative code of any kind. 365 | It's built on top of the SQLAlchemy ORM and provides a super-minimalistic 366 | interface to an existing database. 367 | 368 | SQLModel_ 369 | SQLModel is a library for interacting with SQL databases from Python code, with Python objects. 370 | It is designed to be intuitive, easy to use, highly compatible, and robust. SQLModel is based 371 | on Python type annotations, and powered by Pydantic and SQLAlchemy. 372 | 373 | Zillion_ 374 | Zillion is a free, open data warehousing and dimensional modeling tool that 375 | allows combining and analyzing data from multiple datasources through a 376 | simple API. It writes SQL so you don't have to, and it easily bolts onto 377 | existing database infrastructure via SQLAlchemy. 378 | 379 | .. _Dataset: https://dataset.readthedocs.io/ 380 | .. _RDFLib: https://github.com/RDFLib/rdflib 381 | .. _rdflib-sqlalchemy: https://github.com/RDFLib/rdflib-sqlalchemy 382 | .. _PugSQL: https://pugsql.org/ 383 | .. _SQLSoup: https://sqlsoup.readthedocs.io/ 384 | .. _SQLModel: https://sqlmodel.tiangolo.com/ 385 | .. _Zillion: https://totalhack.github.io/zillion/ 386 | 387 | 388 | Vendor-specific Extensions 389 | -------------------------- 390 | 391 | PostgreSQL 392 | .......... 393 | 394 | `Flask-SQLAlchemy-PGEvents `_ 395 | Flask extension that uses SQLAlchemy and 396 | `psycopg2-pgevents `_ to 397 | enable event listeners tied into database-layer triggers. 398 | 399 | sqlalchemy-crosstab-postgresql_ 400 | New grammar for SQLAlchemy to make handling the ``crosstab()`` tablefunc 401 | (i.e. pivot tables) in PostgreSQL easy peasy. 402 | 403 | sqlalchemy-postgres-copy_ 404 | Wrapper for using PostgreSQL `COPY` with SQLAlchemy for efficient bulk data 405 | imports and exports. 406 | 407 | .. _sqlalchemy-crosstab-postgresql: https://github.com/makmanalp/sqlalchemy-crosstab-postgresql 408 | .. _sqlalchemy-postgres-copy: https://github.com/jmcarp/sqlalchemy-postgres-copy 409 | 410 | 411 | Visualizations 412 | -------------- 413 | 414 | sadisplay_ 415 | Simple package for describing SQLAlchemy schema and display raw database tables by reflecting feature. 416 | 417 | sqlalchemy_schemadisplay_ 418 | This module generates images from SQLAlchemy models. 419 | 420 | eralchemy_ 421 | ERAlchemy generates Entity Relation (ER) diagram from databases or from SQLAlchemy models. 422 | 423 | paracelsus_ 424 | CLI and Library that generates Mermaid and DOT Diagrams from SQLAlchemy models and injects them into documentation. 425 | 426 | .. _sadisplay: https://bitbucket.org/estin/sadisplay 427 | .. _sqlalchemy_schemadisplay: https://github.com/fschulze/sqlalchemy_schemadisplay 428 | .. _eralchemy: https://github.com/Alexis-benoist/eralchemy 429 | .. _paracelsus: https://github.com/tedivm/paracelsus 430 | 431 | 432 | Web 433 | --- 434 | 435 | Framework Integrations 436 | ...................... 437 | 438 | bottle-sqlalchemy_ 439 | A Bottle_ plugin to manage SQLAlchemy session to your application. 440 | 441 | filteralchemy_ 442 | Declarative query builder that auto-generates filter parameters from 443 | models and parses request parameters using marshmallow-sqlalchemy_ 444 | and webargs_. 445 | 446 | Flask-SQLAlchemy_ 447 | Flask-SQLAlchemy is an extension for Flask_ that adds support for 448 | SQLAlchemy to your application. 449 | 450 | Flask-Admin_ 451 | The admin interface framework for Flask_. 452 | With scaffolding for SQLAlchemy, MongoEngine, pymongo and Peewee. 453 | 454 | pyramid_sqlalchemy_ 455 | pyramid_sqlalchemy provides everything needed to use SQLAlchemy in 456 | Pyramid_ applications. 457 | 458 | pyramid_restler_ 459 | pyramid_restler is a somewhat-opinionated toolkit for building 460 | RESTful Web services and applications on top of the 461 | Pyramid framework (with SQLAlchemy models). 462 | 463 | sacrud_ 464 | SACRUD will solve your problem of CRUD interface for SQLAlchemy, 465 | by providing extension for Pyramid_ (yet) or use it in pure form. 466 | Unlike classical CRUD interface, pyramid_sacrud_ allows override and 467 | flexibly customize interface (that is closer to ``django.contrib.admin``). 468 | 469 | SQLA-wrapper_ 470 | A light and framework-independent wrapper for SQLAlchemy that makes 471 | it really easy to setup and use. 472 | 473 | - Doesn't change the SQLAlchemy syntax. 474 | - Can paginate the results of the queries. 475 | - Support for multiple databases at the same time. 476 | 477 | zope.sqlalchemy_ 478 | The aim of this package is to unify the plethora of existing packages 479 | integrating SQLAlchemy with Zope_'s transaction management. 480 | As such it seeks only to provide a data manager and makes no attempt 481 | to define a zopeish way to configure engines. 482 | 483 | .. _Bottle: https://bottlepy.org/ 484 | .. _bottle-sqlalchemy: https://github.com/iurisilvio/bottle-sqlalchemy 485 | .. _filteralchemy: https://github.com/jmcarp/filteralchemy 486 | .. _Flask: https://palletsprojects.com/p/flask/ 487 | .. _Flask-SQLAlchemy: https://pythonhosted.org/Flask-SQLAlchemy/ 488 | .. _Flask-Admin: https://github.com/flask-admin/flask-admin 489 | .. _Pyramid: https://trypyramid.com/ 490 | .. _pyramid_restler: https://github.com/wylee/pyramid_restler 491 | .. _pyramid_sacrud: https://pyramid-sacrud.readthedocs.io/ 492 | .. _pyramid_sqlalchemy: https://pyramid-sqlalchemy.readthedocs.io/ 493 | .. _sacrud: https://sacrud.readthedocs.io/ 494 | .. _SQLA-wrapper: https://github.com/jpscaletti/sqla-wrapper 495 | .. _webargs: https://github.com/marshmallow-code/webargs 496 | .. _Zope: https://www.zope.org/ 497 | .. _zope.sqlalchemy: https://pypi.org/project/zope.sqlalchemy/ 498 | 499 | 500 | Other 501 | ..... 502 | 503 | paginate_sqlalchemy_ 504 | This module helps dividing large lists of items into pages. 505 | The user is shown one page at a time and can navigate to other pages. 506 | 507 | sandman2_ 508 | Generate a curl-able REST HTTP API with searching and filtering 509 | for all tables in a database and an admin UI with Flask-SQLAlchemy 510 | and HTTP Basic Authentication. 511 | 512 | sqlalchemy_mixins_ 513 | A set of well-tested mixins that brings Active Record, Django-like queries, nested eager load and beauty __repr__ to your SQLAlchemy. 514 | 515 | .. _paginate_sqlalchemy: https://github.com/Pylons/paginate_sqlalchemy 516 | .. _sandman2: https://github.com/jeffknupp/sandman2 517 | .. _sqlalchemy_mixins: https://github.com/absent1706/sqlalchemy-mixins 518 | -------------------------------------------------------------------------------- /_.py: -------------------------------------------------------------------------------- 1 | """GitHub infers the programming language by files.""" 2 | --------------------------------------------------------------------------------