Skip to main content

fasthtml-sqlalchemy

Integración de SqlAlchemy con el framework fastHTML

Instalación

pip install fasthtml-sqlalchemy

Ejemplo de uso:

from fasthtml import FastHTML
from fasthtml_sqlalchemy import SQLAlchemy, BaseModel

app = FastHTML()
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'

db = SQLAlchemy(app)

class User(BaseModel):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80), unique=True, nullable=False)

db.create_all()

@app.route("/")
def get():
    users = db.session.query(User).all()
    return str(users)

@app.route("/add/<username>")
def add(username):
    user = User(username=username)
    user.save()
    return f"User {username} added!"

if __name__ == "__main__":
    app.serve()

y la ayuda sigue por aquí ...

Metadata

Release files for fasthtml-sqlalchemy 0.1.0

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

Source distribution (sdist)

Source distribution for fasthtml-sqlalchemy 0.1.0
File Size Uploaded
fasthtml_sqlalchemy-0.1.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fasthtml-sqlalchemy 0.1.0
File Interpreter ABI Platform
fasthtml_sqlalchemy-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / fasthtml_sqlalchemy-0.1.0.tar.gz

Download URL fasthtml_sqlalchemy-0.1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f17b99fb6bdb2d023659f86c01e9fbad4fcacae2199910c31f3d15768be11857
BLAKE2b-256 checksum
How to use checksums
d5b5368d82aa01869a279a16a0ae3605d5f2981b3b80138c24d3fe80c9bb3ae1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / fasthtml_sqlalchemy-0.1.0-py3-none-any.whl

Download URL fasthtml_sqlalchemy-0.1.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10a6c550ab538c28ce56f1ccdd889986c1e911bbd343d1d515db2aab269b6653
BLAKE2b-256 checksum
How to use checksums
cd3a68795c1bb8cee022bea16b672bf0784452115c9f343d223fd2386d048e92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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