summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/automap.py
Commit message (Collapse)AuthorAgeFilesLines
* Replace all http:// links to https://Federico Caselli2021-07-041-2/+2
| | | | | | Also replace http://pypi.python.org/pypi with https://pypi.org/project Change-Id: I84b5005c39969a82140706472989f2a30b0c7685
* have automap suppress overlaps warning for mapped secondaryMike Bayer2021-06-251-0/+9
| | | | | | | | | | | | | | | | Fixed regression in :mod:`sqlalchemy.ext.automap` extension such that the use case of creating an explicit mapped class to a table that is also the :paramref:`_orm.relationship.secondary` element of a :func:`_orm.relationship` that automap will be generating would emit the "overlaps" warnings introduced in 1.4 and discussed at :ref:`error_qzyx`. While generating this case from automap is still subject to the same caveats that the "overlaps" warning refers towards, as automap is intended for more ad-hoc use cases, the condition which produces the warning is disabled when a many-to-many relationship with this particular pattern is generated. Fixes: #6679 Change-Id: Ib3a53982b076ed4999b0d3235f84008b9e2f1cce
* Removed automap deprecation warningjason3gb2021-05-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed a deprecation warning that was emitted when using :func:`_automap.automap_base` without passing an existing ``Base``. Fixes: #6529 <!-- Provide a general summary of your proposed changes in the Title field above --> ### Description Fixed the automap's declarative import from sqlalchemy.orm instead from the deprecated ext.declarative package ### Checklist <!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once) --> This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [x] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. **Have a nice day!** Closes: #6533 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6533 Pull-request-sha: 46d40005eae51fd7423da66f6ad4072f65744c1c Change-Id: I432df70d4221873ca229076d5d3ac20b2870c13b
* Add reflection_options to automapbase.prepare()Gord Thompson2021-02-251-2/+12
| | | | | Fixes: #5942 Change-Id: If72ccca93fbe303799b1bacb7339c4c85e4251aa
* happy new yearMike Bayer2021-01-041-1/+1
| | | | Change-Id: Ic5bb19ca8be3cb47c95a0d3315d84cb484bac47c
* Allow MetaData as the target for column_reflect eventMike Bayer2020-11-181-0/+30
| | | | | | | | | The :meth:`_event.DDLEvents.column_reflect` event may now be applied to a :class:`_schema.MetaData` object where it will take effect for the :class:`_schema.Table` objects local to that collection. Fixes: #5712 Change-Id: I6044baa72d096ebd1fd99128270119747d1461b9
* Deprecate bound metadataMike Bayer2020-10-121-6/+47
| | | | | | | | | | | | | | | | | The :paramref:`_schema.MetaData.bind` argument as well as the overall concept of "bound metadata" is deprecated in SQLAlchemy 1.4 and will be removed in SQLAlchemy 2.0. The parameter as well as related functions now emit a :class:`_exc.RemovedIn20Warning` when :ref:`deprecation_20_mode` is in use. Added new parameter :paramref:`_automap.AutomapBase.prepare.autoload_with` which supersedes :paramref:`_automap.AutomapBase.prepare.reflect` and :paramref:`_automap.AutomapBase.prepare.engine`. Fixes: #4634 Fixes: #5142 Change-Id: Iaabf9b481931e2fb68b97b5954c32e65772a298e
* Build out new declarative systems; deprecate mapper()Mike Bayer2020-09-101-1/+1
| | | | | | | | | | | | | The ORM Declarative system is now unified into the ORM itself, with new import spaces under ``sqlalchemy.orm`` and new kinds of mappings. Support for decorator-based mappings without using a base class, support for classical style-mapper() calls that have access to the declarative class registry for relationships, and full integration of Declarative with 3rd party class attribute systems like ``dataclasses`` and ``attrs`` is now supported. Fixes: #5508 Change-Id: I130b2b6edff6450bfe8a3e6baa099ff04b5471ff
* Run search and replace of symbolic module namesMike Bayer2020-04-141-51/+79
| | | | | | | | Replaces a wide array of Sphinx-relative doc references with an abbreviated absolute form now supported by zzzeeksphinx. Change-Id: I94bffcc3f37885ffdde6238767224296339698a2
* Merge "Use context managers for threading.Lock()"mike bayer2020-01-031-4/+1
|\
| * Use context managers for threading.Lock()Heckad2020-01-031-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | (zzzeek:) For some reason I thought that threading.Lock() still did not support context managers, at least in Python 2, however this does not seem to be the case. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Closes: #5069 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5069 Pull-request-sha: efeac06dda5afdbe33abcf9b27c8b5b5725c8444 Change-Id: Ic64fcd99cd587bc70b4ecc5b45d8205b5c76eff2
* | happy new yearMike Bayer2020-01-011-1/+1
|/ | | | Change-Id: I08440dc25e40ea1ccea1778f6ee9e28a00808235
* Add informative failure modes to _DeferredMapperConfigMike Bayer2019-01-301-0/+11
| | | | | | | | | | | Added some helper exceptions that invoke when a mapping based on :class:`.AbstractConcreteBase`, :class:`.DeferredReflection`, or :class:`.AutoMap` is used before the mapping is ready to be used, which contain descriptive information on the class, rather than falling through into other failure modes that are less informative. Fixes: #4470 Change-Id: I9bc51697f63cedaa7809a0adb17b2398c209e289
* Fix many spell glitchesLele Gaifax2019-01-251-2/+2
| | | | | | | | | | | | This affects mostly docstrings, except in orm/events.py::dispose_collection() where one parameter gets renamed: given that the method is empty, it seemed reasonable to me to fix that too. Closes: #4440 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4440 Pull-request-sha: 779ed75acb6142e1f1daac467b5b14134529bb4b Change-Id: Ic0553fe97853054b09c2453af76d96363de6eb0e
* happy new yearMike Bayer2019-01-111-1/+1
| | | | Change-Id: I6a71f4924d046cf306961c58dffccf21e9c03911
* Post black reformattingMike Bayer2019-01-061-5/+7
| | | | | | | | | | | | | Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
* Run black -l 79 against all source filesMike Bayer2019-01-061-134/+175
| | | | | | | | | | | | | | This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
* Mutex on _CONFIGURE_MUTEX in automap.prepare()Mike Bayer2018-05-281-42/+48
| | | | | | | | | | | | Fixed a race condition which could occur if automap :meth:`.AutomapBase.prepare` were used within a multi-threaded context against other threads which may call :func:`.configure_mappers` as a result of use of other mappers. The unfinished mapping work of automap is particularly sensitive to being pulled in by a :func:`.configure_mappers` step leading to errors. Change-Id: I6d36df6639bf5cb8f137187dff68f386f5e84f88 Fixes: #4266
* happy new yearMike Bayer2018-01-121-1/+1
| | | | Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
* Include missing import in exampleMichael Stewart2017-06-301-0/+1
|
* Protect against cls weakref becoming NoneMike Bayer2017-05-081-2/+2
| | | | | | | | | | Protected against testing "None" as a class in the case where declarative classes are being garbage collected and new automap prepare() operations are taking place concurrently, very infrequently hitting a weakref that has not been fully acted upon after gc. Change-Id: I32e1dfc5ac46bac4127fe808cfd18368e2fad9dd
* New features from python 2.7Катаев Денис2017-03-171-1/+1
| | | | | | | After bump minimum supported version to 2.7 (1da9d3752160430c91534a8868ceb8c5ad1451d4), we can use new syntax. Change-Id: Ib064c75a00562e641d132f9c57e5e69744200e05 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/347
* - add missing param tagMike Bayer2017-01-281-3/+3
| | | | Change-Id: Ic2cc0bdafbf3f1bc2993a9ad3475530eed91d0f1
* - repair an errant docstring w/o rMike Bayer2017-01-171-2/+2
| | | | Change-Id: I2e9c8dbc79c00b54520748d1d7cae5230a612c96
* Support python3.6Mike Bayer2017-01-131-2/+2
| | | | | | | | | | | Corrects some warnings and adds tox config. Adds DeprecationWarning to the error category. Large sweep for string literals w/ backslashes as this is common in docstrings Co-authored-by: Andrii Soldatenko Fixes: #3886 Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Add schema argument to AutomapBase.prepare()Josh Marlow2016-06-021-0/+10
| | | | | | | | | This allows automap to reflect tables from a schema other than the default without the need to resort to calling MetaData.reflect directly. Change-Id: Ie73cb113bd6d115555c09c5efc33d27ad2c9c512 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/237
* Convert readthedocs link for their .org -> .io migration for hosted projectspr/278Adam Chainz2016-05-291-1/+1
| | | | | | | | As per their email ‘Changes to project subdomains’: > Starting today, Read the Docs will start hosting projects from subdomains on the domain readthedocs.io, instead of on readthedocs.org. This change addresses some security concerns around site cookies while hosting user generated data on the same domain as our dashboard. Test Plan: Manually visited all the links I’ve modified.
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - fix link to types in metadata, fixes #3618Mike Bayer2016-01-101-1/+1
| | | | | | - fix "version" got whacked into "f" in core tutorial - fix short underline in automap - fix unmatched boldface in session events
* fix typo: Explcitly -> ExplicitlySven Schliesing2015-11-101-1/+1
|
* Fix code examples in automap's documentationpr/185Yuri Baida2015-06-261-5/+4
| | | Fix camelize_classname and pluralize_collection functions as they didn't work as expected.
* - automap is stableMike Bayer2015-06-181-6/+0
|
* - fix typo MANYTOONE -> MANYTOMANY, fixes #3415Mike Bayer2015-05-051-1/+1
|
* - add boldface for "viable" plus a note describing that thisMike Bayer2015-04-291-1/+7
| | | | refers to the table having a primary key. fixes #3398
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - The :mod:`sqlalchemy.ext.automap` extension will now setMike Bayer2014-09-221-6/+40
| | | | | | | | | | | | | | ``cascade="all, delete-orphan"`` automatically on a one-to-many relationship/backref where the foreign key is detected as containing one or more non-nullable columns. This argument is present in the keywords passed to :func:`.automap.generate_relationship` in this case and can still be overridden. Additionally, if the :class:`.ForeignKeyConstraint` specifies ``ondelete="CASCADE"`` for a non-nullable or ``ondelete="SET NULL"`` for a nullable set of columns, the argument ``passive_deletes=True`` is also added to the relationship. Note that not all backends support reflection of ondelete, but backends that do include Postgresql and MySQL. fixes #3210
* - also add the alternate approach, name column distinctly from attribute name,Mike Bayer2014-07-161-0/+14
| | | | ref #3129
* - add a documentation section for naming conflicts, fixes #3129Mike Bayer2014-07-161-0/+44
|
* PEP8 style fixesBrian Jarrett2014-07-131-189/+228
|
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-1/+1
| | | | Found using: https://github.com/intgr/topy
* clarify doc hereMike Bayer2014-03-281-4/+4
|
* - Added support to automap for the case where a relationship shouldMike Bayer2014-03-281-14/+77
| | | | | | | not be created between two classes that are in a joined inheritance relationship, for those foreign keys that link the subclass back to the superclass. fixes #3004
* - Fixed bug where the :class:`.AutomapBase` class of theMike Bayer2014-02-081-2/+6
| | | | | | | new automap extension would fail if classes were pre-arranged in single or potentially joined inheritance patterns. The repaired joined inheritance issue could also potentially apply when using :class:`.DeferredReflection` as well.
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - many-to-many supportMike Bayer2014-01-051-66/+786
| | | | | - tests - full documentation, changelog, new in 0.9 announcement
* - basic functionality.Mike Bayer2014-01-041-23/+30
|
* - hypothetical "automap" feature, would extend DeferredReflection to create ↵Mike Bayer2014-01-031-0/+113
classes against the remaining tables within the given metadata.