Skip to main content

streamlit-rxdb-dataframe

Custom streamlit component connecting local browser indexedDB database as RxDB collection as dataframe

Demo

demo - based on TodoMVC

Example Screencast

Usage

Provide JSONSchema

JSONSchema
{
  "definitions": {},
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "Todo",
  "description": "Todo Schema",
  "required": ["id", "title", "createdAt"],
  "version": 0,
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id",
      "pattern": "^(.*)$",
      "maxLength": 36,
      "readOnly": true
    },
    "title": {
      "type": "string",
      "title": "Title",
      "minLength": 3
    },
    "completed": {
      "type": "boolean",
      "title": "Done"
    },
    "createdAt": {
      "type": "string",
      "title": "Created Date",
      "format": "date-time",
      "readOnly": true
    },
    "last_modified": {
      "type": "integer",
      "format": "time",
      "title": "Last Modified Date"
    }
  },
  "__indexes": ["createdAt"],
  "primaryKey": "id",
  "attachments": {
    "encrypted": false
  }
}

Provide Collection Config and use streamlit dataframe, data_editor or table

todoSchema: Dict = json.load(open(os.path.join(data_dir, "todo.schema.json")))
# initial_docs: List = json.load(open(os.path.join(data_dir, "col.dump.json")))["docs"]
collection_config = {
    "name": "todo",
    "schema": todoSchema,  # to auto load schema from remote url pass None
    "localDocuments": True,
    "options": {
        # 'schemaUrl': 'assets/data/todo.schema.json',
        # "initialDocs": initial_docs,
    },
}

def on_change_dataframe(rxdb_state: RxDBSessionState):
    print("RxDBDataframe component on_change call")
    print("collection.info()", rxdb_state.info)
    print("dataframe.head()", rxdb_state.dataframe.head())

df = rxdb_dataframe(
    collection_config,
    query=None,
    with_rev=False,
    on_change=on_change_dataframe,
)
st.dataframe(
    df,
    use_container_width=True,
    hide_index=True,
    column_config=st.session_state["rxdb"]["column_config"],
    column_order=["title", "completed", "createdAt"],
)

Run & Build

Run

cd packages/streamlit-rxdb-dataframe/
poetry run streamlit run example.py

Build

poetry build -o ../../dist/packages/streamlit-rxdb-dataframe

Publish

poetry publish -r test-pypi --dist-dir ../../dist/packages/streamlit-rx
db-dataframe

Metadata

Release files for streamlit-rxdb-dataframe 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 streamlit-rxdb-dataframe 0.1.0
File Size Uploaded Provenance Actions
streamlit_rxdb_dataframe-0.1.0.tar.gz 824.0 kB Without provenance Details for streamlit_rxdb_dataframe-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-rxdb-dataframe 0.1.0
File Interpreter ABI Platform Actions
streamlit_rxdb_dataframe-0.1.0-py3-none-any.whl Python 3 none any Details for streamlit_rxdb_dataframe-0.1.0-py3-none-any.whl

Total release size: 1.7 MB

Release files / streamlit_rxdb_dataframe-0.1.0.tar.gz

Download URL streamlit_rxdb_dataframe-0.1.0.tar.gz
Size 824.0 kB
Tags Source
SHA-256 checksum
How to use checksums
854106b58273574258f7804c248fced39a08016a2ccf94e8a7ec985eabaf8168
BLAKE2b-256 checksum
How to use checksums
c2dee1ec3adc4e99fd57d9fdb9bcf538c2570a46feff90b7ed981bde4e806e6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.10.12 Linux/6.6.10-76060610-generic

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

Download URL streamlit_rxdb_dataframe-0.1.0-py3-none-any.whl
Size 838.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0277802ed72dd7878e97d8166c1d725ab126a8677a66f4f72cf4ac20a61624be
BLAKE2b-256 checksum
How to use checksums
70bbe038f169247aad02cfab2d6ae5d94e7dcffd9f7494c934432e2c2ebe5ce9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.10.12 Linux/6.6.10-76060610-generic

Security for streamlit-rxdb-dataframe 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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