Franky1 / Streamlit-Prisma-Example

Streamlit demo project with Prisma Database ORM and Prisma Client Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Streamlit Prisma Database ORM Example Project πŸ’Ž

Streamlit

🚧 WIP 🚧

Streamlit example app with Prisma Database ORM.

Description ✏️

This Streamlit app is only a simple example of how to use Prisma Database ORM with Streamlit. It uses a local SQLite database to store the data. This app is a simple post generator with fake data. Random posts are generated with the Faker library and the py-avataaars library is used to generate avatars. You can add random posts, delete posts and delete all posts.

ToDo β˜‘οΈ

  • Add more CSS styling for the Streamlit app
  • Test Streamlit app on Streamlit Cloud from different clients

Ideas πŸ’‘

  • Make example with an external database instead of local SQLite

Issues πŸ›

  • Prisma Setup/Init on Streamlit Cloud is a bit tricky
  • This app only uses a local SQLite database, there is no external database connection, therefore data is not persistent.

Status

🚧 WIP 🚧

Last changed: 2023-11-26

Prisma Setup πŸ’Ž

Prisma Schema

datasource db {
  provider = "sqlite"
  url      = "file:posts.sqlite"
}

generator client {
  provider             = "prisma-client-py"
  interface            = "sync"
  recursive_type_depth = 5
  output               = "./generated/prisma"
  binaryTargets        = ["native", "debian-openssl-1.1.x", "debian-openssl-3.0.x"]
}

model Post {
  id      Int      @id @default(autoincrement())
  uuid    String   @unique @default(uuid())
  created DateTime @default(now())
  author  String
  title   String
  content String?
  avatar  Bytes?
}

Resources πŸ“š

Links πŸ”—

About

Streamlit demo project with Prisma Database ORM and Prisma Client Python

License:MIT License


Languages

Language:Python 77.4%Language:Makefile 15.3%Language:Dockerfile 6.2%Language:CSS 1.1%