mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-20 15:42:11 -04:00
30ee4263c0
<!-- Provide a general summary of your proposed changes in the Title field above --> ### Description <!-- Describe your changes in detail --> Remove print statements ### 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: - [X] A documentation / typographical error fix - Good to go, no issue or tests are needed - [ ] 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: #5166 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5166 Pull-request-sha:04a7394f71Change-Id: Ib90a59fac929661a18748c6e44966fb87e3978c6 (cherry picked from commita836e3df5d)
26 lines
825 B
Python
26 lines
825 B
Python
"""
|
|
Illustrates three strategies for persisting and querying XML
|
|
documents as represented by ElementTree in a relational
|
|
database. The techniques do not apply any mappings to the
|
|
ElementTree objects directly, so are compatible with the
|
|
native cElementTree as well as lxml, and can be adapted to
|
|
suit any kind of DOM representation system. Querying along
|
|
xpath-like strings is illustrated as well.
|
|
|
|
E.g.::
|
|
|
|
# parse an XML file and persist in the database
|
|
doc = ElementTree.parse("test.xml")
|
|
session.add(Document(file, doc))
|
|
session.commit()
|
|
|
|
# locate documents with a certain path/attribute structure
|
|
for document in find_document('/somefile/header/field2[@attr=foo]'):
|
|
# dump the XML
|
|
print(document)
|
|
|
|
.. autosource::
|
|
:files: pickle_type.py, adjacency_list.py, optimized_al.py
|
|
|
|
"""
|