Has anyone successfully gotten Streamlit to work with SQLModel? I get errors
InvalidRequestError: Table 'company' is already defined for this MetaData instance. Specify 'extend_existing=True' to redefine options and columns on an existing Table object.
So I tried to work around by clearing my MetaData at the beginning of my main file with:
from sqlmodel import SQLModel
tables = [v for k,v in SQLModel.metadata.tables.items()]
for t in tables:
SQLModel.metadata.remove(t)
That was moderately successful… however, depending on the order of my imports I get errors:
InvalidRequestError: Multiple classes found for path "Event" in the registry of this declarative base. Please use a fully module-qualified path.
or a slightly different error
InvalidRequestError: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper[Company(company)]'. Original exception was: Multiple classes found for path "Event" in the registry of this declarative base. Please use a fully module-qualified path.
Which shouldn’t be happening. EVERY import I use is a fully qualified path.
I don’t necessarily care about caching – is there a way to tell streamlit to do a full restart each refresh? I didn’t see anything in the docs about this