Skip to content

Repository files navigation

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

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages