mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 10:51:55 +00:00
python-sqlalchemy: bump to 2.0.49
Changelog: https://docs.sqlalchemy.org/en/20/changelog/changelog_20.html Patch release (resets PKG_RELEASE to 1). Add test.sh to verify ORM and core SQL functionality. Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
committed by
Alexandru Ardelean
parent
3667982c08
commit
d090b03d1e
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=python-sqlalchemy
|
||||
PKG_VERSION:=2.0.44
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=2.0.49
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PYPI_NAME:=sqlalchemy
|
||||
PKG_HASH:=0ae7454e1ab1d780aee69fd2aae7d6b8670a581d8847f2d1e0f7ddfbf47e5a22
|
||||
PKG_HASH:=d15950a57a210e36dd4cec1aac22787e2a4d57ba9318233e2ef8b2daf9ff2d5f
|
||||
|
||||
PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
|
||||
PKG_LICENSE:=MIT
|
||||
|
||||
35
lang/python/python-sqlalchemy/test.sh
Executable file
35
lang/python/python-sqlalchemy/test.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
[ "$1" = python3-sqlalchemy ] || exit 0
|
||||
python3 - << 'EOF'
|
||||
import sqlalchemy
|
||||
assert sqlalchemy.__version__, "sqlalchemy version is empty"
|
||||
|
||||
from sqlalchemy import create_engine, Column, Integer, String, text
|
||||
from sqlalchemy.orm import DeclarativeBase, Session
|
||||
|
||||
engine = create_engine("sqlite:///:memory:")
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "users"
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String)
|
||||
|
||||
Base.metadata.create_all(engine)
|
||||
|
||||
with Session(engine) as session:
|
||||
session.add(User(name="Alice"))
|
||||
session.add(User(name="Bob"))
|
||||
session.commit()
|
||||
users = session.query(User).order_by(User.name).all()
|
||||
assert len(users) == 2
|
||||
assert users[0].name == "Alice"
|
||||
assert users[1].name == "Bob"
|
||||
|
||||
with engine.connect() as conn:
|
||||
result = conn.execute(text("SELECT count(*) FROM users"))
|
||||
count = result.scalar()
|
||||
assert count == 2, f"Expected 2, got {count}"
|
||||
EOF
|
||||
Reference in New Issue
Block a user