
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
A SQLAlchemy extension for its declarative ORM that provides enhancements for model classes, queries, and sessions.
alchy
|version| |travis| |coveralls| |license|
A SQLAlchemy extension for its declarative ORM that provides enhancements for model classes, queries, and sessions.
PROJECT IS IN MAINTENANCE MODE: NO NEW FEATURES, BUG FIXES ONLY
Use sqlservice <https://github.com/dgilland/sqlservice>
_ instead.
.. |version| image:: http://img.shields.io/pypi/v/alchy.svg?style=flat-square :target: https://pypi.python.org/pypi/alchy/
.. |travis| image:: http://img.shields.io/travis/dgilland/alchy/master.svg?style=flat-square :target: https://travis-ci.org/dgilland/alchy
.. |coveralls| image:: http://img.shields.io/coveralls/dgilland/alchy/master.svg?style=flat-square :target: https://coveralls.io/r/dgilland/alchy
.. |license| image:: http://img.shields.io/pypi/l/alchy.svg?style=flat-square :target: https://pypi.python.org/pypi/alchy/
binds
value via session_options
during Manager
in initialization. Thanks brianbruggeman_!events.before_delete
where decorator was defined using invalid parent class making it completely non-functional as a decorator.metadata
argument to alchy.model.make_declarative_base
to provide custom metaclass for declarative base model. Thanks fabioramponi_!Meta
argument to alchy.model.make_declarative_base
to provide custom metaclass for declarative base model. Thanks elidchan_!Session.get_bind()
mapper
argument have default value of None
.Query.index_by
.Query.chain
.pydash
as dependency and incorporate into existing Query
methods: map
, reduce
, reduce_right
, and pluck
.__tablename__
to work with all table inheritance styles (joined, single, and concrete), to handle @declared_attr
columns, and not to duplicate underscore characters. Thanks sethp_!__table_args__
and __mapper_args__
(unless overridden in subclass) by merging __global_table_args__
and __global_mapper_args__
from all classes in the class's mro()
with __local_table_args__
and __local_mapper_args__
from the class itself. A __{global,local}_{table,mapper}_args__
may be callable or classmethod, in which case it is evaluated on the class whose __{table,mapper}_args__
is being set. Thanks sethp_! (breaking change)__table_args__
and __local_table_args__
. Thanks sethp_!Model.is_modified()
. Thanks sethp_!Model.filter()
.Model.filter_by()
.search.inenum
and search.notinenum
for performing an in_
and not(in_)
comparision using DeclarativeEnum
.Model.__bind_key__
to be set at the declarative base level so that model classes can properly inherit it.ModelBase
's __table_args__
and __mapper_args__
inheritable via mixins. Thanks sethp_!__enum_args__
to DeclarativeEnum
. Thanks sethp_!DeclarativeEnum.db_type()
. Thanks sethp_!Model.update()
when setting a non-list relationship automatically instantiate dict
values using the relationship model class.{}
when calling Model.to_dict()
instead of leaving as None
.Model.update()
when setting a list relationship automatically instantiate dict
values using the relationship model class.alias
keyword argument to Query.join_eager()
and Query.outerjoin_eager()
to be a dict
mapping aliases to join keys. Enables nested aliases.Model.update()
calls to relationship attributes so that setting relationship to empty dict
will propagate None
to relationship attribute value correctly.query.LoadOption
to support nesting load options when calling the query.Query
load methods: join_eager
, outerjoin_eager
, joinedload
, immediateload
, lazyload
, noload
, and subqueryload
.@classproperty
decorators in ModelBase
with @classmethod
. Any previously defined class properties now require method access. Affected attributes are: session
, primary_key
, primary_keys
, primary_attrs
, attrs
, descriptors
, relationships
, column_attrs
, and columns
. (breaking change)getitem
and setitem
access to getattr
and setattr
in ModelBase
. Allows models to be accessed like dictionaries.alchy.events
decorators class based.alchy.events
decorators to be instantiated using a function call (e.g. @events.before_update()
instead of @events.before_update
). (breaking change)alchy.search
comparators, eqenum
and noteqenum
, for comparing DeclarativeEnum
types.utils.iterflatten()
by calling iterflatten()
instead of flatten
in recursive loop.ModelBase.primary_attrs
class property that returns a list of class attributes that are primary keys.ModelBase.primary_attrs
in QueryModel.search()
so that it handles cases where primary keys have column names that are different than the class attribute name.QueryModel.search()
to better handle searching on a query object that already has joins and filters applied.search.icontains
and search.noticontains
for case insensitive contains filter.Model.update()
. Require this to be implemented in user-land. (breaking change)Query.search
so that pagination works properly.session_class
argument to Manager
which can override the default session class used.ModelMeta
when checking whether to do tablename autogeneration, tranverse all base classes when trying to determine if a primary key is defined.ModelMeta
set bind_key
in __init__
method instead of __new__
. This also fixes an issue where __table_args__
was incorrectly assumed to always be a dict
.order_by
as list/tuple in QueryModel.search()
.QueryModel.search()
where order_by
wasn't applied in the correct order. Needed to come before limit/offset are applied.query_property
argument from make_declarative_base()
and extend_declarative_base()
. (breaking change)ModelBase.primary_keys
class property which returns a tuple always (ModelBase.primary_key
returns a single key if only one present or a tuple if multiple).QueryProperty
from alchy.model
to alchy.query
. (breaking change)Query
subclass named QueryModel
which is to be used within a query property context. Replace Query
with QueryModel
as default query class. (breaking change)__advanced_search__
and __simple_search__
class attributes from ModelBase
to QueryModel
. (breaking change)QueryModel.__search_filters__
which can define a canonical set of search filters which can then be referenced in the list version of __advanced_search__
and __simple_search__
.QueryModel.search()
to use a subquery joined onto the originating query in order to support pagination when one-to-many and many-to-many joins are present on the originating query. (breaking change)alchy.search.<method>()
. Allows for alchy.search.contains(lambda: Foo.id)
to be used at the class attribute level when Foo.id
will be defined later.any_/notany_
and has/nothas
which can be used for the corresponding relationship operators.alchy.Query
's loading API (i.e. missing sqlalchemy.orm.strategy_options.Load
). This allows alchy
to be used with earlier versions of SQLAlchemy at user's own risk.alchy.search
module which provides compatible search functions for ModelBase.__advanced_search__
and ModelBase.__simple_search__
.ModelBase.session
to proxy ModelBase.query.session
.ModelBase.object_session
proxy to orm.object_session(ModelBase)
.engine_config_prefix
argument to Manager()
. (breaking change)session_options
argument to Manager()
. (breaking change)Manager.config
options to follow Flask-SQLAlchemy. (breaking change)Manager.config
to be either a dict
, class
, or module object
.Manager
instance.__bind_key__
configuration option for ModelBase
for binding model to specific database bind (similar to Flask-SQLAlchemy).ModelBase.update()
don't nest update()
calls if field attribute is a dict
.refresh_on_empty
argument to ModelBase.to_dict()
and instead implement ModelBase.__to_dict__
configuration property as place to handle processing of model before casting to dict
. (breaking change)ModelBase.__to_dict__
configuration property which handles preprocessing for model instance and returns a set of fields as strings to be used as dict keys when calling to_dict()
.alchy.ManagerBase
to alchy.ManagerMixin
. (breaking change)pylint
support.six
.before_
or after_
with on_
. Specifically, on_set
, on_append
, on_remove
, on_append_result
, on_create_instance
, on_instrument_class
, on_mapper_configured
, on_populate_instance
, on_translate_row
, on_expire
, on_load
, and on_refresh
. (breaking change)Manager
. Require that Model
and config
be passed in at init time. While this removes some functionality, it's done to simplify the Manager
code so that it's more straightforward. If lazy initialization is needed, then a proxy class should be used. (breaking change)ModelBase.primary_key
class property for retrieving primary key(s).Base=None
argument to make_declarative_base()
to support passing in a subclass of ModelBase
. Previously had to create a declarative Model
to pass in a subclassed ModelBase
.ModelBase.query
attribute access bubble up (previously, UnmappedClassError
was caught).six
(for Python 3 support)ModelBase.to_dict()
only include fields which are mapper descriptors.to_dict
method hook when iterating over objects in ModelBase.to_dict()
.to_dict
method hook to EnumSymbol
(propagates to DeclarativeEnum
).__iter__
method in model so that dict(model)
is equilvalent to model.to_dict()
.refresh_on_empty=True
argument to ModelBase.to_dict()
which supports calling ModelBase.refresh()
if __dict__
is empty.ModelBase.save()
method which adds model instance loaded from session to transaction.ModelBase.get_by()
which proxies to ModelBase.query.filter_by().first()
.events
.before_insert_update
and after_insert_update
.ModelBase.advanced_search_config
to ModelBase.__advanced_search__
.ModelBase.simple_search_config
to ModelBase.__simple_search__
ModelMeta
metaclass.__tablename__
autogeneration from class name.ModelBase.__events__
and/or model.event
decorator.model.make_declarative_base
in Manager
class.query_class
to declarative model if none defined.model.make_declarative_base()
accept predefined base and just extend its functionality... _sethp: https://github.com/https://github.com/seth-p .. _elidchan: https://github.com/elidchan .. _fabioramponi: https://github.com/fabioramponi .. _brianbruggeman: https://github.com/brianbruggeman
FAQs
A SQLAlchemy extension for its declarative ORM that provides enhancements for model classes, queries, and sessions.
We found that alchy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.