Write new card straight in metabase DB

Hello,

I've connected directly to to MB DB (we use postgres for MB DB) and checked how question data is stored in metabase (in report_Card table).
We use selfhosted MB installation.

To me it seems all data about a regular question is there in this single table (query, name, query_type, collection etc).

So say I make a SQL insert in report_card table directly of a new row (let's say same data as one exiting row). Does it basically means it will copy a question (and the question will just work in UI), correctly, or there are other DB relationships/entities that are created when using UI (or API) to create a question and it's a bad idea to just write it in DB directly.

It's a bad idea! While you could make it work, what happens when there's an upgrade?
Stick to the API.

1 Like

The API (could) also break in case of an update. But I'm not sure why an update would be an issue in my case (only for questions written in DB). Basically this was my question, if I duplicate a row in report_card table does it make a 100% copy of the original question (so if you have an update it shouldn't break, unless a update will also break the original question)

The API is less likely to break from an update as you're a layer of abstraction away from the 'proper' stuff.

Whether or not it works, it won't be supported.

2 Likes