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.3.tar.gz
(45.5 kB
view hashes)
Built Distribution
Close
Hashes for streamlit_sqlalchemy-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e31b1e67845f41ce93f4a196d0cb5176b57b2cdd68e46bd81c4e65b52dc258a4 |
|
MD5 | f584bf05d5b70e627eb5a09aea4112fe |
|
BLAKE2b-256 | 68e44df7192800526e550b4e7d7c1db1c2056d78da0be2a133415feaffa3eaff |
Close
Hashes for streamlit_sqlalchemy-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e343ec2e60115a3746d3be59944c4494e49f88e84f9eeb7685672bcd95a14670 |
|
MD5 | 6c236b3c22837c82303012b0c36cd072 |
|
BLAKE2b-256 | b789edefa867269e32903fcdb5ce4ed1270041933306955e737e4367d13ba339 |