streamlit-sqlalchemy
Some templating for streamlit and sqlalchemy
Status & Objectives
- Integer fields
- String fields
- Many2One
- Many2Many
Usage
python3 -m pip install streamlit-sqlalchemy
python3 -m streamlit run example.py
Add the mixin to your SQLAlchemy defined class
# sqlalchemy stuff
Base = declarative_base()
engine = create_engine("sqlite:///db.sqlite3")
class Awesome(Base, StreamlitAlchemyMixin):
__tablename__ = "awesome"
id = Column(Integer, primary_key=True)
name = Column(String)
other_field = Column(Integer)
Then you need to link the Mixin with the Base, in order to have access to the foreign keys. And to the engine for access to the database.
# Must be called before any other method
StreamlitAlchemyMixin.sam_initialize(Base, engine)
Then you have access to streamlit components.
# The classic 3 tabs
Awesome.sam_crud_tabs()
# Create
Awesome.sam_create_form()
# Update with a select choice on top
Awesome.sam_update_select_form()
# Delete with a select choice on top
Awesome.sam_delete_select_form()
for awesome in Awesome.sam_get_all():
# Update a single element
awesome.sam_update_form()
# Delete an element
awesome.sam_delete_button()
Contribute
You are welcome to contribute!
Release files for streamlit-sqlalchemy 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| streamlit_sqlalchemy-0.0.3.tar.gz | 45.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streamlit_sqlalchemy-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 53.8 kB
Release files / streamlit_sqlalchemy-0.0.3.tar.gz
| Download URL | streamlit_sqlalchemy-0.0.3.tar.gz |
|---|---|
| Size | 45.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e31b1e67845f41ce93f4a196d0cb5176b57b2cdd68e46bd81c4e65b52dc258a4
|
|
BLAKE2b-256 checksum How to use checksums |
68e44df7192800526e550b4e7d7c1db1c2056d78da0be2a133415feaffa3eaff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / streamlit_sqlalchemy-0.0.3-py3-none-any.whl
| Download URL | streamlit_sqlalchemy-0.0.3-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e343ec2e60115a3746d3be59944c4494e49f88e84f9eeb7685672bcd95a14670
|
|
BLAKE2b-256 checksum How to use checksums |
b789edefa867269e32903fcdb5ce4ed1270041933306955e737e4367d13ba339
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|