All Projects → fizyk → pyramid_basemodel

fizyk / pyramid_basemodel

Licence: Unlicense license
Global base classes for Pyramid SQLAlchemy applications.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pyramid basemodel

Cookiecutter Pyramid Talk Python Starter
An opinionated Cookiecutter template for creating Pyramid web applications starting way further down the development chain. This cookiecutter template will create a new Pyramid web application with email, sqlalchemy, rollbar, and way more integrated.
Stars: ✭ 64 (+357.14%)
Mutual labels:  sqlalchemy, pyramid
pyramid-cookiecutter-alchemy
[DEPRECATED - Please use https://github.com/pylons/pyramid-cookiecutter-starter instead] A Cookiecutter (project template) for creating a Pyramid project using SQLite for persistent storage, SQLAlchemy for an ORM, Alembic for database migrations, URL dispatch for routing, and Jinja2 for templating.
Stars: ✭ 39 (+178.57%)
Mutual labels:  sqlalchemy, pyramid
Ziggurat foundations
Framework agnostic set of sqlalchemy classes that make building applications that require permissions an easy task.
Stars: ✭ 67 (+378.57%)
Mutual labels:  sqlalchemy, pyramid
Zope.sqlalchemy
Integration of SQLAlchemy with transaction management
Stars: ✭ 30 (+114.29%)
Mutual labels:  sqlalchemy, pyramid
Data Driven Web Apps With Pyramid And Sqlalchemy
Demos and handouts for Talk Python's Data-Driven Web Apps with Pyramid and SQLAlchemy course
Stars: ✭ 79 (+464.29%)
Mutual labels:  sqlalchemy, pyramid
databricks-dbapi
DBAPI and SQLAlchemy dialect for Databricks Workspace and SQL Analytics clusters
Stars: ✭ 21 (+50%)
Mutual labels:  sqlalchemy
Flask-Validator
Validator for SQLAlchemy Models
Stars: ✭ 27 (+92.86%)
Mutual labels:  sqlalchemy
yosai alchemystore
SQLAlchemy-enabled Account Store for Yosai that features a flat Role-Based Access Control (RBAC) data model
Stars: ✭ 17 (+21.43%)
Mutual labels:  sqlalchemy
CourseCake
By serving course 📚 data that is more "edible" 🍰 for developers, we hope CourseCake offers a smooth approach to build useful tools for students.
Stars: ✭ 21 (+50%)
Mutual labels:  sqlalchemy
alchemy-mock
SQLAlchemy mock helpers.
Stars: ✭ 74 (+428.57%)
Mutual labels:  sqlalchemy
Qwerkey
Qwerkey is a social media platform for connecting and learning more about mechanical keyboards built on React and Redux in the frontend and Flask in the backend on top of a PostgreSQL database.
Stars: ✭ 22 (+57.14%)
Mutual labels:  sqlalchemy
programming-crypto-contracts
Programming Crypto Blockchain Contracts Step-by-Step Book / Guide. Let's Start with Ponzi & Pyramid Schemes. Run Your Own Lotteries, Gambling Casinos and more on the Blockchain World Computer...
Stars: ✭ 54 (+285.71%)
Mutual labels:  pyramid
shillelagh
Making it easy to query APIs via SQL
Stars: ✭ 172 (+1128.57%)
Mutual labels:  sqlalchemy
bag
A Python library for several purposes
Stars: ✭ 25 (+78.57%)
Mutual labels:  sqlalchemy
fastapi-saas-base
Fast API SAAS Base App
Stars: ✭ 47 (+235.71%)
Mutual labels:  sqlalchemy
mock-alchemy
SQLAlchemy mock helpers.
Stars: ✭ 44 (+214.29%)
Mutual labels:  sqlalchemy
sqlalchemy-adapter
SQLAlchemy Adapter for PyCasbin
Stars: ✭ 53 (+278.57%)
Mutual labels:  sqlalchemy
favv
Fullstack Web Application Framework With FastAPI + Vite + VueJS. Streamlit for rapid development.
Stars: ✭ 17 (+21.43%)
Mutual labels:  sqlalchemy
hypothesis sqlalchemy
hypothesis strategies for generating SQLAlchemy objects
Stars: ✭ 24 (+71.43%)
Mutual labels:  sqlalchemy
magql
The magical GraphQL framework that generates an API for your data.
Stars: ✭ 26 (+85.71%)
Mutual labels:  sqlalchemy

pyramid_basemodel

pyramid_basemodel is a thin, low level package that provides an SQLAlchemy declarative Base and a thread local scoped Session that can be used by different packages whilst only needing to be bound to a db engine once.

Usage

You can use these as base classes for declarative model definitions, e.g.::

from pyramid_basemodel import Base, BaseMixin, Session, save

class MyModel(Base, BaseMixin):
    """Example model class."""
    
    @classmethod
    def do_foo(cls):
        instance = Session.query(cls).first()
        save(instance)

You can then bind these to the sqlalchemy.url in your paster .ini config by importing your model and this package, e.g.:

# for example in yourapp.__init__.py
import mymodel

def main(global_config, **settings):
    config = Configurator(settings=settings)
    config.include('pyramid_basemodel')
    config.include('pyramid_tm')
    return config.make_wsgi_app()

Or if this is all too much voodoo, you can just use the bind_engine function::

from pyramid_basemodel import bind_engine
from mypackage import mymodel

# assuming `engine` is a bound SQLAlchemy engine.
bind_engine(engine)

Note that the Session is designed to be used in tandem with pyramid_tm. If you don't include pyramid_tm, you'll need to take care of committing transactions yourself.

Tests

To run the tests use:

py.test -v --cov pyramid_basemodel tests/
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].