How can I use SQL views as DataSource (without Postgres)

For few years I used Forest admin with Sequelize. Now I don’t want to use Sequelize anymore so I have a direct connection between Forest admin and my database.
I’m trying to make a copy of what exists with Sequelize (but without sequelize).
All collections are correctly import but my main problem is that I have 2 SQL Views that I’m unable to “import” on Forest Admin.
The documentation I found is only with Sequelize.

  • Project name: magma
  • Team name: Magma
  • Agent (forest package) name & version: “@forestadmin/agent”: “^1.29.1” & “@forestadmin/datasource-sql”: “^1.7.27”
  • Database type: PostgreSQL
  • Recent changes made on your end if any: I recreated a project from scratch

Hello @Hugo_LARROUSSE,

The package @forestadmin/datasource-sql is introspecting your database and looks for tables. Right now it does not support views. I’m adding this feedback to our product board, in order to have this need prioritized.

In the meantime, if you need to add this view to your admin panel, the easiest way to do this is to add another datasource based on sequelize, or to implement collections by yourself. I think the first solution is the easiest.

Thank you @GuillaumeGautreau,

Would you tell me where I can find the documentation to add another datasource based on sequelize?
I only find documentation about direct db url datasource.

You can find an example here: Sequelize datasource.

You’ll need to create a model matching your view, and add a sequelize datasource using model definitions to your existing agent.