=====================================================
z3c.sqlalchemy - A SQLAlchemy wrapper for Python/Zope
=====================================================
What is z3c.sqlalchemy?
=======================
z3c.sqlalchemy is yet another wrapper around SQLAlchemy. The functionality of
the wrapper is basically focused on easy integration with Zope.
The wrapper cares about connection handling, optional transaction integration
with Zope and wrapper management (caching, introspection). z3c.sqlalchemy
gives you flexible control over the mapper creation. Mapper classes can be
- auto-generated (with or without autodetection of table relationships)
- configured by the developer
What z3c.sqlalchemy does not do and won't do:
=============================================
- no support for Zope 3 schemas
- no support for Archetypes schemas
z3c.sqlachemy just tries to provide you with the basic functionalities you need
to write SQLAlchemy-based applications with Zope. Higher-level
functionalities like integration with Archetypes/Zope 3 schemas are subject to
higher-level frameworks. z3c.sqlalchemy does not address these frameworks.
Requirements:
=============
- Zope 5 or higher
- SQLAlchemy 1.4 or higher
- zope.sqlalchemy 1.2.0 or higher
- Python 3.7 or higher
Installation:
=============
Using pip::
pip install z3c.sqlalchemy
Note:
-----
z3c.sqlalchemy depends on the modules **zope.component**, **zope.schema**
and **zope.interface**. If you are using z3c.sqlalchemy in a Python-only
environment, ensure the these components have to be installed either
as eggs or by setting the PYTHONPATH to a corresponding Zope installation.
Usage
=====
Basic usage::
from z3c.sqlalchemy import createSAWrapper
wrapper = createSAWrapper('postgres://postgres:postgres@host/someDB')
session = wrapper.session
FormatMapper = wrapper.getMapper('format') # auto-generated mapper for table 'format'
for row in session.query(FormatMapper).select(...): print row
session.flush() # if necessary
The session will participate automatically in a Zope transaction. The wrapper
will call automatically session.flush() upon a transaction commit. Please note
that 'wrapper.session' will always return the same session instance within the
same transaction and same thread.
For a real-world application you don't want to create a new wrapper for every
new request. Instead you want to register a wrapper instance as named utility
(ISQLAlchemyWrapper) and lookup up the wrapper (the utility!) by name from
within your application. This approach is very similiar to looking up an
databases adapter or a ZSQL method through acquisition.
By default "wrapper.getMapper(name)" will always auto-generate a new mapper
class by using SQLAlchemy auto-load feature. The drawback of this approach is
that the mapper class does not know about relationships to other tables. Assume
we have a one-to-many relationship between table A and B and you want
z3c.sqlalchemy to generate a mapper that is aware of this relationship. For
this purpose you can create a wrapper with a "model" as optional parameter. A
model is basically a configuration or a series of hints in order to tell
z3c.sqlalchemy how mappers a generated.
Example::
from z3c.sqlalchemy import createSAWrapper, Model
model = Model()
model.add(name='A', relations=('B',))
wrapper = createSAWrapper('postgres://postgres:postgres@host/someDB', model=model)
AMapper= wrapper.getMapper('A')
This will generate a mapper AMapper where all instances of AMapper have a
property 'B' that relates to all corresponding rows in B (see the SQLAlchemy
documentation on mappers, properties and relation()). In this example you
define the relationship between A and B explictly through the 'relations'
parameter (as a sequence of related table names).
z3c.sqlalchemy also supports the auto-detection of relationships between tables.
Unfortunately SQLAlchemy does not support this feature out-of-the-box and in a portable
way. Therefore this feature of z3c.sqlalchemy is highly experimental and currently
only available for Postgres (tested with Postgres 8.X).::
from z3c.sqlalchemy import createSAWrapper, Model
model = Model()
model.add(name='A', autodetect_relations=True)
wrapper = createSAWrapper('postgres://postgres:postgres@host/someDB', model=model)
AMapper= wrapper.getMapper('A')
In this case z3c.sqlalchemy will scan all tables in order to detect
relationships automatically and build the mapper class and its properties
according to the found relationships. Warning: this feature is experimental and
it might take some time to scan all tables before the first request. Currently
only Postgres tables in the 'public' schema are supported).
In same cases you might be interested to use your own base classes for a
generated mapper. Also this usecase is supported by passing the base class to
the model using the 'mapper_class' parameter::
from z3c.sqlalchemy import createSAWrapper, Model
from z3c.sqlalchemy.mapper import MappedClassBase
class MyAMapper(MappedClassBase): pass
model = Model()
model.add(name='A', relations=('B',) mapper_class = MyAMapper)
wrapper = createSAWrapper('postgres://postgres:postgres@host/someDB', model=model)
AMapper= wrapper.getMapper('A') # AMapper will be an instance of MyAMapper
When you are working with wrapper in a Zope environment you are usually
interested to to register a wrapper instance as named utility implementing
ISQLAlchemyWrapper. You can can perform the registration lazily by passing the
name utility as 'name' parameter to the createSAWrapper(...,
name='my.postgres.test.db') method.
A convenience method for obtaining a wrapper instance by name is available
through getSAWrapper::
createSAWrapper(dsn,..., name='my.name')
...
wrapper = getSAWrapper('my.name')
Supported systems
=================
z3c.sqlalchemy was developed with Zope and basically tested against
Postgres 7.4.X and 8.X and SQLite 3.3.
Known issues
============
Running z3c.sqalchemy against MySQL databases without transaction support might
cause trouble upon the implicit commit() operation. For this reason MySQL without
transaction support isn't supported right now
Author
======
z3c.sqlalchemy was written by Andreas Jung for Haufe Mediengruppe, Freiburg, Germany
and ZOPYX Ltd. & Co. KG, Tuebingen, Germany.
License
=======
z3c.sqlalchemy is licensed under the Zope Public License 2.1.
See LICENSE.txt.
Credits
=======
Parts of the code are influenced by z3c.zalchemy (Juergen Kartnaller, Michael
Bernstein & others) and Alchemist/ore.alchemist (Kapil Thangavelu). Thanks to
Martin Aspeli for giving valuable feedback.
Change log
==========
2.2 (2024-04-09)
----------------
- Add support for Python 3.12.
- Partially revert commit fb7d533aae819dc7e1aef8322c2f2d60a9a1b5d0
which caused the sqlalchemy session instance to be persisted as an instance attribute.
(`#21 <https://github.com/zopefoundation/z3c.sqlalchemy/issues/21>`_)
2.1.1 (2023-09-06)
------------------
- Fix transaction rollback with DBAPI cursor.execute.
(`#17 <https://github.com/zopefoundation/z3c.sqlalchemy/issues/17>`_)
2.1 (2023-07-05)
----------------
- Support ``SQLAlchemy >= 2.0``.
(`#15 <https://github.com/zopefoundation/z3c.sqlalchemy/issues/15>`_)
2.0 (2023-03-01)
----------------
- Add support for Python 3.10, 3.11.
- Drop support for Python 2.7, 3.5, 3.6.
1.5.2 (2020-11-13)
------------------
- Fix ``MANIFEST`` to include the change log.
1.5.1 (2020-11-13)
------------------
- Add linting to ``tox`` configuration and apply linting fixes.
- Fix installation error in setup.py (release 1.5.0 is broken).
1.5.0 (2020-11-13)
------------------
- Add support for Python 3.5-3.9.
- Standardize namespace __init__.
- Fix to work with zope.sqlalchemy 1.2.
1.4.0 (2009-12-02)
------------------
- Remove compatibility code with older Zope versions.
- Fix import issue with modern zope.component versions.
- Fix registering of custom mappers.
1.3.11 (26.10.2009)
-------------------
- Don't create a new MetaData in LazyMapperCollection,
but use the one created in the wrapper.
In some cases, you could have some tables in the metadata created in the wrapper,
and some tables in the metadata created in the LazyMapperCollection,
which gave an error when trying to create relations.
- When generating the mapper class, make sure table.name is a string.
It can be unicode when use_unicode=1 with MySQL engine.
1.3.10 (04.08.2009)
-------------------
- removed SA deprecation warning
1.3.9 (06.01.2009)
------------------
- made 'twophase' configurable
1.3.8 (06.01.2009)
------------------
- replace asDict() with a dictish proxy implementation
1.3.7 (12.12.2008)
------------------
- better support for SQLAlchemy declarative layer
1.3.6 (23.11.2008)
------------------
- zip_safe=False
1.3.5 (05.09.2008)
------------------
- restored compatibiltiy with SA 0.4.X
1.3.4 (04.09.2008)
------------------
- added 'extension_options' parameter
1.3.2 (29.07.2008)
------------------
- updated dependencies to latest zope.sqlalchemy release
1.3.1 (24.06.2008)
------------------
- relaxed zope.* dependencies
1.3.0 (02.06.2008)
------------------
- support for sqlalchemy.ext.declarative
1.2.0 (25.05.2008)
------------------
- now using zope.sqlalchemy for ZODB transaction integration
- internal class renaming
- removed PythonBaseWrapper. Now there is only *one* ZopeWrappe class.
- requires SQLAlchemy 0.4.6 or higher
- requires zope.sqlalchemy 0.1 or higher
1.1.5 (08.05.2008)
------------------
- better error handling in case of a rollback (patch by Dieter Maurer)
1.1.4 (15.03.2008)
------------------
- reorganized .txt files
1.1.3 (20.02.2008)
-------------------
- another savepoint fix
- fixed regression error introduced by previous change: commit the
zope transaction when ready in tpc_finish [maurits]
- fixed issue where session's transaction.nested was being called as
a callable (it should be straight attribute access) [Rocky]
1.1.2 (16.02.2008)
-------------------
- fixed ZODB savepoint implementation. Now returning a proper dummy
savepoint
1.1.1 (13.02.2008)
-------------------
- the SessionDataManager now supports ZODB savepoints
1.1.0 (17.01.2008)
-------------------
- WARNING: this version requires SA 0.4.X and higher
- fixed import issues with the upcoming SA 0.4.X series
- create_session() calls (for SA 0.4.X)
- the unittests support an optional $TEST_DSN environment in order
to run the test against an existing database (other than SQLite)
- major overhoul of the Zope transaction integration: now using
one DataManager for the session object and the connection. The
connection as returned through the 'connection' property is also
used for creating a new 'session'. Older z3c.sqlalchemy version
used separate connections. This allows applications to use both
a session and a connection within the same Zope request/thread
without running into transaction problems. SQL actions and
session related modifications should happen within the same
transaction.
- Wrapper constructor now accepts two new optional dicts
'engine_options' and 'session_options' that will be passed down
to the engine and the sessionmaker. Patch provided by
Klaus Barthelmann.
- mapped objects now provide a method asDict() to return the values
of an objects as dict.
1.0.11 (30.07.2007)
-------------------
- replaced BoundMetaData() with MetaData() (requires SA 0.3.9+)
- removed zope.* dependencies in order to avoid zope.* version
mismatches for now
1.0.10 (16.07.2007)
-------------------
- using Zope 3.3.X as a fixed depenceny
1.0.9 (08.07.2007)
------------------
- added namespace declarations
- reST-ified documentation
1.0.8 (28.06.2007)
------------------
- SessionDataManager: create a session transaction as late
as possible and only if necessary in order to minimize deadlocks.
So z3c.sqlalchemy won't create a transaction any more if there
only SELECT operations within the current session.
1.0.7 (27.06.2007)
------------------
- SessionDataManager: moved commit code from tpc_vote()
to tpc_finish() (Thanks to Christian Theune for the hint)
1.0.6 (25.06.2007)
------------------
- added 'namespace_packages' directive to setup.py
- cache 'metadata' property
1.0.5 (13.06.2007)
------------------
- It should be now safe to use sessions from multiple wrappers
within one Zope transaction. In former versions of z3c.sqlalchemy
calling wrapper1.session and wrapper2.session within the same
transaction would return a session bound to wrapper1 in both
cases.
1.0.4 (09.06.2007)
------------------
- added new 'transactional' flag (used by SQLAlchemyDA only)
1.0.3 (26.05.2007)
------------------
- new 'cascade' parameter for the Model.add()
- tweaked the ZODB transaction integration a bit
1.0.2 (13.05.2007)
------------------
- MappedClassBase has a new convinience method getMapper() that returns a
mapper class associated through a relation with the current mapper
1.0.1 (unreleased)
------------------
- MappedClassBase: new clone() method
- more checks in Model.add()
1.0.0 (05.05.2007)
------------------
- source code polishing
- documentation update
0.1.13 (05.05.2007)
-------------------
- sessions were returned from the wrong cache
- moved the rollback/commit handling inside the SessionDataManager
in order to play more nicely with the TPC. See
http://mail.zope.org/pipermail/zodb-dev/2007-May/010996.html
0.1.12 (03.05.2007)
-------------------
- createSAWrapper() got a new optional 'name' parameter in order
to register the wrapper automatically instead of using a dedicated
registerSAWrapper(wrapper, name) call
0.1.11 (02.05.2007)
-------------------
- added check for the 'mapper_class' attribute (classes from now
on must be a subclass of MapperClassBase)
- a Zope-aware SAWrapper now has a 'connection' property that can
be used to execute SQL statements directly. 'connection' is an
instance of sqlalchemy.Connection and directly tied to the current
Zope transaction.
- changed the caching of the connection and session object for Zope wrapper
since the id of a transaction is not reliable (different transaction
object can re-use the same memory address leading to cache errors)
0.1.10 (30.04.2007)
-------------------
- fixed a bug in mapper (unfortunately I forgot to commit a
necessary change)
- removed the 'primary_key' parameter introduced in 0.1.9 because
we don't need. It can be defined within the model using a
PrimaryKeyConstraint()
- createSAWrapper: setting forZope=True for a non-postgres DSN
now also returns a Zope-aware wrapper instance (instead
of a BaseWrapper instance). (Reported by Martin Aspeli)
0.1.9 (26.04.2007)
------------------
- base.py: the 'model' parameter can now also be a callable
returning an instance of model.Model
- base.py: calling a model provider or a method providing a
model with a BoundMetaData instance in order to allow
table auto-loading
- Model.add() got a new parameter 'primary_key' in order to specify a
primary_key hint. This is useful when you are trying to auto-load a view
as Table() having no primary key information. The 'primary_key' parameter is
either None or a sequence of column names.
0.1.8 (23.04.2007)
------------------
- added shorter method names as aliases
- don't generate a new mapper class if a custom mapper
class is defined within the model
0.1.7 (21.04.2007)
------------------
- replaced 'echo' parameter of the constructor with a generic keyword
parameter in order to provide full parameter support for
create_engine. Optional arguments passed to the constructur are
passed directly to create_engine()
- fixed the documentation a bit
- added registerMapper() to BaseWrapper class
- registerSQLAlchemyWrapper() now defers the registration until
the Wrapper is used first when calling getSQLAlchemyWrapper()
- the 'name' parameter of Model.add() now supports schemas (if
available). E.g. when using Postgres you can reference as
table within a different schema through '<schema>.<tablename>'.
- Model.add() accepts a new optional parameter 'table_name' that
can be used to specify the name of a table (including schema
information) when you want to use the 'name' parameter as
an alias for the related table/mapper.
0.1.6 (28.03.2007)
------------------
- fixed a bug in registerSQLAlchemyWrapper
0.1.5 (28.03.2007)
------------------
- registerSQLAlchemyWrapper() should now work with Zope 2.8-2.10
- abort() was defined twice inside the DataManager class
0.1.4 (21.03.2007)
------------------
- the Model class now behave (where needed) as a sorted
dictionary. Its items() method must returned all items
in insertion order.
0.1.3 (20.03.2007)
------------------
- added getMappers() convenience method
- the Zope wrapper uses SessionTransactions in order to be able
to flush() as session with a transaction in order to read
row previously inserted within the same transaction
0.1.2 (unreleased)
------------------
- fixed class hierarchy issues with Postgres wrapper classes
0.1.1 (unreleased)
------------------
- fixed setup.py
0.1 (18.03.2007)
----------------
- initial version
Raw data
{
"_id": null,
"home_page": "https://github.com/zopefoundation/z3c.sqlalchemy",
"name": "z3c.sqlalchemy",
"maintainer": "Zope Foundation and Contributors",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "zope-dev@zope.dev",
"keywords": null,
"author": "Andreas Jung",
"author_email": "info@zopyx.com",
"download_url": "https://files.pythonhosted.org/packages/8d/d7/b35a4007621f8cc0a4bcb38e25a5e3b949ea839a0783730dc60ec210ceb2/z3c.sqlalchemy-2.2.tar.gz",
"platform": null,
"description": "=====================================================\nz3c.sqlalchemy - A SQLAlchemy wrapper for Python/Zope\n=====================================================\n\n\nWhat is z3c.sqlalchemy?\n=======================\n\nz3c.sqlalchemy is yet another wrapper around SQLAlchemy. The functionality of\nthe wrapper is basically focused on easy integration with Zope.\nThe wrapper cares about connection handling, optional transaction integration\nwith Zope and wrapper management (caching, introspection). z3c.sqlalchemy\ngives you flexible control over the mapper creation. Mapper classes can be\n\n- auto-generated (with or without autodetection of table relationships)\n- configured by the developer\n\n\nWhat z3c.sqlalchemy does not do and won't do:\n=============================================\n\n- no support for Zope 3 schemas\n- no support for Archetypes schemas\n\nz3c.sqlachemy just tries to provide you with the basic functionalities you need\nto write SQLAlchemy-based applications with Zope. Higher-level\nfunctionalities like integration with Archetypes/Zope 3 schemas are subject to\nhigher-level frameworks. z3c.sqlalchemy does not address these frameworks.\n\n\nRequirements:\n=============\n\n- Zope 5 or higher\n- SQLAlchemy 1.4 or higher\n- zope.sqlalchemy 1.2.0 or higher\n- Python 3.7 or higher\n\n\nInstallation:\n=============\n\nUsing pip::\n\n pip install z3c.sqlalchemy\n\n\nNote:\n-----\nz3c.sqlalchemy depends on the modules **zope.component**, **zope.schema**\nand **zope.interface**. If you are using z3c.sqlalchemy in a Python-only\nenvironment, ensure the these components have to be installed either\nas eggs or by setting the PYTHONPATH to a corresponding Zope installation.\n\n\nUsage\n=====\n\nBasic usage::\n\n from z3c.sqlalchemy import createSAWrapper\n wrapper = createSAWrapper('postgres://postgres:postgres@host/someDB')\n session = wrapper.session\n FormatMapper = wrapper.getMapper('format') # auto-generated mapper for table 'format'\n for row in session.query(FormatMapper).select(...): print row\n session.flush() # if necessary\n\nThe session will participate automatically in a Zope transaction. The wrapper\nwill call automatically session.flush() upon a transaction commit. Please note\nthat 'wrapper.session' will always return the same session instance within the\nsame transaction and same thread.\n\nFor a real-world application you don't want to create a new wrapper for every\nnew request. Instead you want to register a wrapper instance as named utility\n(ISQLAlchemyWrapper) and lookup up the wrapper (the utility!) by name from\nwithin your application. This approach is very similiar to looking up an\ndatabases adapter or a ZSQL method through acquisition.\n\nBy default \"wrapper.getMapper(name)\" will always auto-generate a new mapper\nclass by using SQLAlchemy auto-load feature. The drawback of this approach is\nthat the mapper class does not know about relationships to other tables. Assume\nwe have a one-to-many relationship between table A and B and you want\nz3c.sqlalchemy to generate a mapper that is aware of this relationship. For\nthis purpose you can create a wrapper with a \"model\" as optional parameter. A\nmodel is basically a configuration or a series of hints in order to tell\nz3c.sqlalchemy how mappers a generated.\n\nExample::\n\n from z3c.sqlalchemy import createSAWrapper, Model\n model = Model()\n model.add(name='A', relations=('B',))\n wrapper = createSAWrapper('postgres://postgres:postgres@host/someDB', model=model)\n AMapper= wrapper.getMapper('A')\n\nThis will generate a mapper AMapper where all instances of AMapper have a\nproperty 'B' that relates to all corresponding rows in B (see the SQLAlchemy\ndocumentation on mappers, properties and relation()). In this example you\ndefine the relationship between A and B explictly through the 'relations'\nparameter (as a sequence of related table names).\n\nz3c.sqlalchemy also supports the auto-detection of relationships between tables.\nUnfortunately SQLAlchemy does not support this feature out-of-the-box and in a portable\nway. Therefore this feature of z3c.sqlalchemy is highly experimental and currently\nonly available for Postgres (tested with Postgres 8.X).::\n\n from z3c.sqlalchemy import createSAWrapper, Model\n model = Model()\n model.add(name='A', autodetect_relations=True)\n wrapper = createSAWrapper('postgres://postgres:postgres@host/someDB', model=model)\n AMapper= wrapper.getMapper('A')\n\nIn this case z3c.sqlalchemy will scan all tables in order to detect\nrelationships automatically and build the mapper class and its properties\naccording to the found relationships. Warning: this feature is experimental and\nit might take some time to scan all tables before the first request. Currently\nonly Postgres tables in the 'public' schema are supported).\n\nIn same cases you might be interested to use your own base classes for a\ngenerated mapper. Also this usecase is supported by passing the base class to\nthe model using the 'mapper_class' parameter::\n\n from z3c.sqlalchemy import createSAWrapper, Model\n from z3c.sqlalchemy.mapper import MappedClassBase\n class MyAMapper(MappedClassBase): pass\n model = Model()\n model.add(name='A', relations=('B',) mapper_class = MyAMapper)\n wrapper = createSAWrapper('postgres://postgres:postgres@host/someDB', model=model)\n AMapper= wrapper.getMapper('A') # AMapper will be an instance of MyAMapper\n\nWhen you are working with wrapper in a Zope environment you are usually\ninterested to to register a wrapper instance as named utility implementing\nISQLAlchemyWrapper. You can can perform the registration lazily by passing the\nname utility as 'name' parameter to the createSAWrapper(...,\nname='my.postgres.test.db') method.\n\nA convenience method for obtaining a wrapper instance by name is available\nthrough getSAWrapper::\n\n createSAWrapper(dsn,..., name='my.name')\n ...\n wrapper = getSAWrapper('my.name')\n\n\nSupported systems\n=================\n\nz3c.sqlalchemy was developed with Zope and basically tested against\nPostgres 7.4.X and 8.X and SQLite 3.3.\n\n\nKnown issues\n============\n\nRunning z3c.sqalchemy against MySQL databases without transaction support might\ncause trouble upon the implicit commit() operation. For this reason MySQL without\ntransaction support isn't supported right now\n\n\nAuthor\n======\n\nz3c.sqlalchemy was written by Andreas Jung for Haufe Mediengruppe, Freiburg, Germany\nand ZOPYX Ltd. & Co. KG, Tuebingen, Germany.\n\n\nLicense\n=======\n\nz3c.sqlalchemy is licensed under the Zope Public License 2.1.\n\nSee LICENSE.txt.\n\n\nCredits\n=======\n\nParts of the code are influenced by z3c.zalchemy (Juergen Kartnaller, Michael\nBernstein & others) and Alchemist/ore.alchemist (Kapil Thangavelu). Thanks to\nMartin Aspeli for giving valuable feedback.\n\n\n\nChange log\n==========\n\n2.2 (2024-04-09)\n----------------\n\n- Add support for Python 3.12.\n\n- Partially revert commit fb7d533aae819dc7e1aef8322c2f2d60a9a1b5d0\n which caused the sqlalchemy session instance to be persisted as an instance attribute.\n (`#21 <https://github.com/zopefoundation/z3c.sqlalchemy/issues/21>`_)\n\n\n2.1.1 (2023-09-06)\n------------------\n\n- Fix transaction rollback with DBAPI cursor.execute.\n (`#17 <https://github.com/zopefoundation/z3c.sqlalchemy/issues/17>`_)\n\n\n2.1 (2023-07-05)\n----------------\n\n- Support ``SQLAlchemy >= 2.0``.\n (`#15 <https://github.com/zopefoundation/z3c.sqlalchemy/issues/15>`_)\n\n\n2.0 (2023-03-01)\n----------------\n\n- Add support for Python 3.10, 3.11.\n\n- Drop support for Python 2.7, 3.5, 3.6.\n\n\n1.5.2 (2020-11-13)\n------------------\n\n- Fix ``MANIFEST`` to include the change log.\n\n\n1.5.1 (2020-11-13)\n------------------\n\n- Add linting to ``tox`` configuration and apply linting fixes.\n\n- Fix installation error in setup.py (release 1.5.0 is broken).\n\n\n1.5.0 (2020-11-13)\n------------------\n\n- Add support for Python 3.5-3.9.\n\n- Standardize namespace __init__.\n\n- Fix to work with zope.sqlalchemy 1.2.\n\n\n1.4.0 (2009-12-02)\n------------------\n\n- Remove compatibility code with older Zope versions.\n\n- Fix import issue with modern zope.component versions.\n\n- Fix registering of custom mappers.\n\n1.3.11 (26.10.2009)\n-------------------\n\n- Don't create a new MetaData in LazyMapperCollection,\n but use the one created in the wrapper.\n In some cases, you could have some tables in the metadata created in the wrapper,\n and some tables in the metadata created in the LazyMapperCollection,\n which gave an error when trying to create relations.\n\n- When generating the mapper class, make sure table.name is a string.\n It can be unicode when use_unicode=1 with MySQL engine.\n\n1.3.10 (04.08.2009)\n-------------------\n\n - removed SA deprecation warning\n\n1.3.9 (06.01.2009)\n------------------\n\n - made 'twophase' configurable\n\n1.3.8 (06.01.2009)\n------------------\n\n - replace asDict() with a dictish proxy implementation\n\n1.3.7 (12.12.2008)\n------------------\n\n - better support for SQLAlchemy declarative layer\n\n1.3.6 (23.11.2008)\n------------------\n\n - zip_safe=False\n\n1.3.5 (05.09.2008)\n------------------\n\n - restored compatibiltiy with SA 0.4.X\n\n1.3.4 (04.09.2008)\n------------------\n\n - added 'extension_options' parameter\n\n1.3.2 (29.07.2008)\n------------------\n\n - updated dependencies to latest zope.sqlalchemy release\n\n1.3.1 (24.06.2008)\n------------------\n\n - relaxed zope.* dependencies\n\n1.3.0 (02.06.2008)\n------------------\n\n - support for sqlalchemy.ext.declarative\n\n1.2.0 (25.05.2008)\n------------------\n\n - now using zope.sqlalchemy for ZODB transaction integration\n\n - internal class renaming\n\n - removed PythonBaseWrapper. Now there is only *one* ZopeWrappe class.\n\n - requires SQLAlchemy 0.4.6 or higher\n\n - requires zope.sqlalchemy 0.1 or higher\n\n1.1.5 (08.05.2008)\n------------------\n\n - better error handling in case of a rollback (patch by Dieter Maurer)\n\n1.1.4 (15.03.2008)\n------------------\n\n - reorganized .txt files\n\n1.1.3 (20.02.2008)\n-------------------\n\n - another savepoint fix\n\n - fixed regression error introduced by previous change: commit the\n zope transaction when ready in tpc_finish [maurits]\n\n - fixed issue where session's transaction.nested was being called as\n a callable (it should be straight attribute access) [Rocky]\n\n\n1.1.2 (16.02.2008)\n-------------------\n\n - fixed ZODB savepoint implementation. Now returning a proper dummy\n savepoint\n\n1.1.1 (13.02.2008)\n-------------------\n\n - the SessionDataManager now supports ZODB savepoints\n\n1.1.0 (17.01.2008)\n-------------------\n\n - WARNING: this version requires SA 0.4.X and higher\n\n - fixed import issues with the upcoming SA 0.4.X series\n\n - create_session() calls (for SA 0.4.X)\n\n - the unittests support an optional $TEST_DSN environment in order\n to run the test against an existing database (other than SQLite)\n\n - major overhoul of the Zope transaction integration: now using\n one DataManager for the session object and the connection. The\n connection as returned through the 'connection' property is also\n used for creating a new 'session'. Older z3c.sqlalchemy version\n used separate connections. This allows applications to use both\n a session and a connection within the same Zope request/thread\n without running into transaction problems. SQL actions and\n session related modifications should happen within the same\n transaction.\n\n - Wrapper constructor now accepts two new optional dicts\n 'engine_options' and 'session_options' that will be passed down\n to the engine and the sessionmaker. Patch provided by\n Klaus Barthelmann.\n\n - mapped objects now provide a method asDict() to return the values\n of an objects as dict.\n\n\n1.0.11 (30.07.2007)\n-------------------\n\n - replaced BoundMetaData() with MetaData() (requires SA 0.3.9+)\n\n - removed zope.* dependencies in order to avoid zope.* version\n mismatches for now\n\n\n1.0.10 (16.07.2007)\n-------------------\n\n - using Zope 3.3.X as a fixed depenceny\n\n\n1.0.9 (08.07.2007)\n------------------\n\n - added namespace declarations\n\n - reST-ified documentation\n\n\n1.0.8 (28.06.2007)\n------------------\n\n - SessionDataManager: create a session transaction as late\n as possible and only if necessary in order to minimize deadlocks.\n So z3c.sqlalchemy won't create a transaction any more if there\n only SELECT operations within the current session.\n\n\n1.0.7 (27.06.2007)\n------------------\n\n - SessionDataManager: moved commit code from tpc_vote()\n to tpc_finish() (Thanks to Christian Theune for the hint)\n\n1.0.6 (25.06.2007)\n------------------\n\n - added 'namespace_packages' directive to setup.py\n\n - cache 'metadata' property\n\n1.0.5 (13.06.2007)\n------------------\n\n - It should be now safe to use sessions from multiple wrappers\n within one Zope transaction. In former versions of z3c.sqlalchemy\n calling wrapper1.session and wrapper2.session within the same\n transaction would return a session bound to wrapper1 in both\n cases.\n\n1.0.4 (09.06.2007)\n------------------\n\n - added new 'transactional' flag (used by SQLAlchemyDA only)\n\n1.0.3 (26.05.2007)\n------------------\n\n - new 'cascade' parameter for the Model.add()\n\n - tweaked the ZODB transaction integration a bit\n\n1.0.2 (13.05.2007)\n------------------\n\n - MappedClassBase has a new convinience method getMapper() that returns a\n mapper class associated through a relation with the current mapper\n\n\n1.0.1 (unreleased)\n------------------\n\n - MappedClassBase: new clone() method\n\n - more checks in Model.add()\n\n\n1.0.0 (05.05.2007)\n------------------\n\n - source code polishing\n\n - documentation update\n\n\n0.1.13 (05.05.2007)\n-------------------\n\n - sessions were returned from the wrong cache\n\n - moved the rollback/commit handling inside the SessionDataManager\n in order to play more nicely with the TPC. See\n http://mail.zope.org/pipermail/zodb-dev/2007-May/010996.html\n\n\n0.1.12 (03.05.2007)\n-------------------\n\n - createSAWrapper() got a new optional 'name' parameter in order\n to register the wrapper automatically instead of using a dedicated\n registerSAWrapper(wrapper, name) call\n\n0.1.11 (02.05.2007)\n-------------------\n\n - added check for the 'mapper_class' attribute (classes from now\n on must be a subclass of MapperClassBase)\n\n - a Zope-aware SAWrapper now has a 'connection' property that can\n be used to execute SQL statements directly. 'connection' is an\n instance of sqlalchemy.Connection and directly tied to the current\n Zope transaction.\n\n - changed the caching of the connection and session object for Zope wrapper\n since the id of a transaction is not reliable (different transaction\n object can re-use the same memory address leading to cache errors)\n\n\n0.1.10 (30.04.2007)\n-------------------\n\n - fixed a bug in mapper (unfortunately I forgot to commit a\n necessary change)\n\n - removed the 'primary_key' parameter introduced in 0.1.9 because\n we don't need. It can be defined within the model using a\n PrimaryKeyConstraint()\n\n - createSAWrapper: setting forZope=True for a non-postgres DSN\n now also returns a Zope-aware wrapper instance (instead\n of a BaseWrapper instance). (Reported by Martin Aspeli)\n\n\n0.1.9 (26.04.2007)\n------------------\n\n - base.py: the 'model' parameter can now also be a callable\n returning an instance of model.Model\n\n - base.py: calling a model provider or a method providing a\n model with a BoundMetaData instance in order to allow\n table auto-loading\n\n - Model.add() got a new parameter 'primary_key' in order to specify a\n primary_key hint. This is useful when you are trying to auto-load a view\n as Table() having no primary key information. The 'primary_key' parameter is\n either None or a sequence of column names.\n\n\n0.1.8 (23.04.2007)\n------------------\n\n - added shorter method names as aliases\n\n - don't generate a new mapper class if a custom mapper\n class is defined within the model\n\n\n0.1.7 (21.04.2007)\n------------------\n\n - replaced 'echo' parameter of the constructor with a generic keyword\n parameter in order to provide full parameter support for\n create_engine. Optional arguments passed to the constructur are\n passed directly to create_engine()\n\n - fixed the documentation a bit\n\n - added registerMapper() to BaseWrapper class\n\n - registerSQLAlchemyWrapper() now defers the registration until\n the Wrapper is used first when calling getSQLAlchemyWrapper()\n\n - the 'name' parameter of Model.add() now supports schemas (if\n available). E.g. when using Postgres you can reference as\n table within a different schema through '<schema>.<tablename>'.\n\n - Model.add() accepts a new optional parameter 'table_name' that\n can be used to specify the name of a table (including schema\n information) when you want to use the 'name' parameter as\n an alias for the related table/mapper.\n\n\n0.1.6 (28.03.2007)\n------------------\n\n - fixed a bug in registerSQLAlchemyWrapper\n\n0.1.5 (28.03.2007)\n------------------\n\n - registerSQLAlchemyWrapper() should now work with Zope 2.8-2.10\n\n - abort() was defined twice inside the DataManager class\n\n0.1.4 (21.03.2007)\n------------------\n\n - the Model class now behave (where needed) as a sorted\n dictionary. Its items() method must returned all items\n in insertion order.\n\n0.1.3 (20.03.2007)\n------------------\n\n - added getMappers() convenience method\n\n - the Zope wrapper uses SessionTransactions in order to be able\n to flush() as session with a transaction in order to read\n row previously inserted within the same transaction\n\n\n0.1.2 (unreleased)\n------------------\n\n - fixed class hierarchy issues with Postgres wrapper classes\n\n\n0.1.1 (unreleased)\n------------------\n\n - fixed setup.py\n\n0.1 (18.03.2007)\n----------------\n\n - initial version\n",
"bugtrack_url": null,
"license": "ZPL 2.1",
"summary": "A SQLAlchemy wrapper for Zope",
"version": "2.2",
"project_urls": {
"Homepage": "https://github.com/zopefoundation/z3c.sqlalchemy",
"Issue Tracker": "https://github.com/zopefoundation/z3c.sqlalchemy/issues",
"Sources": "https://github.com/zopefoundation/z3c.sqlalchemy"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d8c44a22fd30483c7b3f3df2ed43b578f559def21d04e6ccc23779cbd0c0d5cb",
"md5": "d4eaadf3d4078122cfbd5c3703294280",
"sha256": "e8104abc5a71f4fd3075201280c9feea9081f6021607547c699e1b0f2a63cd06"
},
"downloads": -1,
"filename": "z3c.sqlalchemy-2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d4eaadf3d4078122cfbd5c3703294280",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 22420,
"upload_time": "2024-04-09T15:34:11",
"upload_time_iso_8601": "2024-04-09T15:34:11.296080Z",
"url": "https://files.pythonhosted.org/packages/d8/c4/4a22fd30483c7b3f3df2ed43b578f559def21d04e6ccc23779cbd0c0d5cb/z3c.sqlalchemy-2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8dd7b35a4007621f8cc0a4bcb38e25a5e3b949ea839a0783730dc60ec210ceb2",
"md5": "8a0376a0bf039b7d8e9f6c90c8854f53",
"sha256": "408606526139356e7ec4a6653b0708757d230e2ef7280e37573247666254aecd"
},
"downloads": -1,
"filename": "z3c.sqlalchemy-2.2.tar.gz",
"has_sig": false,
"md5_digest": "8a0376a0bf039b7d8e9f6c90c8854f53",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 26248,
"upload_time": "2024-04-09T15:34:13",
"upload_time_iso_8601": "2024-04-09T15:34:13.671237Z",
"url": "https://files.pythonhosted.org/packages/8d/d7/b35a4007621f8cc0a4bcb38e25a5e3b949ea839a0783730dc60ec210ceb2/z3c.sqlalchemy-2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-09 15:34:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zopefoundation",
"github_project": "z3c.sqlalchemy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "z3c.sqlalchemy"
}