Some templating for streamlit and sqlalchemy
Project description
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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
streamlit_sqlalchemy-0.0.4.tar.gz
(47.4 kB
view hashes)
Built Distribution
Close
Hashes for streamlit_sqlalchemy-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 354a8af4a772c65a1a0b14d6bdc85d713e8efd178adf84a9b4e2aedb807bfc26 |
|
MD5 | 85b1e49fa19238513e1437fe0b189046 |
|
BLAKE2b-256 | e9b1e67b0dc39f71121a78074e8eee8a8a61a02c7217e66141fe9bc4394f12dc |
Close
Hashes for streamlit_sqlalchemy-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec055367f127754f31a0018e5595312a64d1c6da62c0f06b935ec58008e52dd6 |
|
MD5 | 5bcf6ff439c1187f0a9cb70f9c70516c |
|
BLAKE2b-256 | ba48c2f8178c774eb1bb9cb52bed42e6a30e3252b148ee7b587f7bf3945e1b9f |