Skip to main content

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Description: SQLAlchemy Sugar: sugar syntax of select/delete functions of SQLAlchemy, especially asyncio.

In SQLAlchemy document , the original Asyncio API of SQLAlchemy is like below:

engine = create_async_engine("sqlite:///:memory:")

async with AsyncSession(engine) as session:
    stmt = select(A).options(selectinload(A.bs))
    result = await session.execute(stmt)
    for a1 in result.scalars():
        print(a1)

    result = await session.execute(select(A).order_by(A.id))
    a1 = result.scalars().first()
    a1.data = "new data"
    await session.commit()

but with this wrapper:

from sqlalchemy_sugar import select

engine = create_async_engine("sqlite:///:memory:")

async with AsyncSession(engine) as session:
    for a1 in await select(A).options(selectinload(A.bs)).scalar(session):
        print(a1)

    a1 = await select(A).order_by(A.id).first(session)
    a1.data = "new data"
    await session.commit()

And also, deleting row is like below:

async with AsyncSession(engine) as session:
    stmt = delete(A).filter_by(data="a2")
    await session.execute(stmt)

but with this wrapper:

from sqlalchemy_sugar import delete

async with AsyncSession(engine) as session:
    await delete(A).filter_by(data="a2").execute(session)

SQLAlchemy document: https://docs.sqlalchemy.org/en/14/orm/extensions/asyncio.html#sqlalchemy.ext.asyncio.AsyncScalarResult

Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Intended Audience :: Developers Classifier: Topic :: Software Development :: Build Tools Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10

Metadata

Release files for sqlalchemy-sugar 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlalchemy-sugar 0.1.1
File Size Uploaded Provenance Actions
sqlalchemy-sugar-0.1.1.tar.gz 3.4 kB Without provenance Details for sqlalchemy-sugar-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sqlalchemy-sugar 0.1.1
File Interpreter ABI Platform Actions
sqlalchemy_sugar-0.1.1-py3-none-any.whl Python 3 none any Details for sqlalchemy_sugar-0.1.1-py3-none-any.whl

Total release size: 8.5 kB

Release files / sqlalchemy-sugar-0.1.1.tar.gz

Download URL sqlalchemy-sugar-0.1.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b28276b46324ff78e2702c96a8127080cb28746dfeab40be7cfa6f18ed5592af
BLAKE2b-256 checksum
How to use checksums
80b10d6ad982d899b43046d20f790f1a1c3da434b7a36e125b7cdffae2af6f99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.5

Release files / sqlalchemy_sugar-0.1.1-py3-none-any.whl

Download URL sqlalchemy_sugar-0.1.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24e1e3e3b21e0130fd2a54144eeb139ef0b99325c157b73a6354f3752c87e87a
BLAKE2b-256 checksum
How to use checksums
b6b1377248f35c37a9f5395e44b6ef0cb40e536568572b2ef331b8b8e5f976a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.5

Security for sqlalchemy-sugar 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page