Sqlalchemy dash integration

1.) I am using sqlalchemy (currently with sqlite) as database for my (multipage)-dashapps. I was just wondering if this is the correct way to do this:

inside init.py:

import os
import flask
from flask import Flask
import dash
import dash_html_components as html
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
import dash_bootstrap_components as dbc

server = flask.Flask(__name__)

server.config['SECRET_KEY'] = 'mysecretkey'
basedir = os.path.abspath(os.path.dirname(__file__))
server.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'data.sqlite')

db = SQLAlchemy(server)

external_stylesheets = [dbc.themes.BOOTSTRAP]

app = dash.Dash(

app.config.suppress_callback_exceptions = True 

A problem I am facing is that my DB file gets corrupted (malfunction error) when I start to experiment with the tables (e.g. adding 50+ entries) and I have to set up the database from scratch again. so I am wondering if it is because I have a mistake in the initialization process?

2.) Another Question: Is there a particular database that is recommended to use with Dash ? (For Production Apps that multiple user can use at the same time)?

Thank You!!

Hi @Iwas,

Did you got any insight about the correct way to integrate sqlalchemy with dash ?

Currently I am using just SQLAlchemy instead of (flask_sqlalchemy), but it would be nice to have some tutorial about best pratices, specially for multi-user situations (multi-tenant architecture).