Giter Site home page Giter Site logo

Support multiple databases about sqladmin HOT 1 CLOSED

meetinger avatar meetinger commented on June 3, 2024
Support multiple databases

from sqladmin.

Comments (1)

hsiaoer avatar hsiaoer commented on June 3, 2024 1

Hello - thanks in advance for an awesome open sourced repo! I'm also interested in how we can support a connection to multiple databases. On thing I've tried is to have multiple Admin view associated with a single FastAPI app.

admins = [
    Admin(app, create_engine(database_dsn), base_url=f"/{customer_name}", title=customer_name)
    for customer_name, database_dsn in multiple_databases
]
for admin in admins:
    admin.add_view(MyView)

This builds correctly but when we then dig into each admin app, the links point to the wrong Admin app for the customer. For example, if I'm looking at models for customer B (url=mysite.com/customer-b), all the links in the app will point to customer A (url=mysite.com/customer-a/item). I've traced the issue to to this spot https://github.com/aminalaee/sqladmin/blob/main/sqladmin/application.py#L406 where the mounted app is associated with name='admin' which may be contributing to mixed links if using multiple admin views.

Happy to contribute to solve for the multi-database use case but wanted to see if there are any ideas

from sqladmin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.