Skip to main content

Vetariasn: An new framework for developing great application

Usage

This is API example.

# An simple CRUD example.
import vetariasn as vt

class Employee(vt.orm.Base):
    # vt.orm.Base is an subclass of sqlalchemy.orm.DeclarativeBase
    # __tablename__ is optional. Convention over Configuration.
    uid = vt.orm.op.Column(int, primary_key=True) # vt.orm.op == sqlalchemy
    name = vt.orm.op.Column(str, unique=True, nullable=False)

class Message(vt.transient.Base):
    # vt.transient: in-memory sqlite ORM API.
    seq = vt.orm.op.Column(int, primary_key=True)
    sender = vt.orm.op.Column(int, primary_key=True)
    target = vt.orm.op.Column(int, primary_key=True)
    content = vt.orm.op.Column(vt.orm.op.Text(), nullable=False)

# Create.
@vt.http.get("/create-employee")
async def create_employee(name: str):
    async with vt.orm.Session() as session:
        uid = vt.algo.calc_seqid() # Snowflake UID
        # An simple creation operation
        result = (await session.execute(
            vt.orm.op.select(Employee)
            .where(Employee.name == name)
        )).fetchone()
        if result is not None:
            return {"uid": result._tuple()[0].uid, "already": True}
        session.add(Employee(uid=uid, name=name))
        await session.commit()
    return {"uid": uid, "already": False}

# Read.
@vt.http.get("/get-employee/{name}")
async def get_employee_by_name(name: str):
    async with vt.orm.Session() as session:
        result = (await session.execute(
            vt.orm.op.select(Employee)
            .where(Employee.name == name)
        )).fetchone()
        if result is None:
            return {"found": False, "uid": 0, "name": ""}
        employee = result._tuple()[0]
        return {"found": True, "uid": employee.uid, "name": employee.name}

# Start system.
if __name__ == "__main__":
    vt.run()

Environment Variables

Variable Description
VETA_DB_URL Database URL (Sqlalchemy Async)
VETA_HTTP_PORT HTTP Web Port

Metadata

Release files for vetariasn 0.1.1

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

Built distribution (wheel)

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

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

Download URL vetariasn-0.1.1-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e822f8734f2d919f5303d9351de1faa17fbafe1c51932faa2ccf7c081109bd6
BLAKE2b-256 checksum
How to use checksums
ec6278a1b76eec5059860162de6a2c020e597d4b228911200c6c3050d9734e56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for vetariasn 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

1 release file 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