Metabase Actions

I wanted to check if anyone can help me.

It’s the first time I’m using “actions” for models.
I tried testing it, but the database I was using didn’t have write access. I managed to get access to one that does, but I still can’t get it to work.

I’m getting this error:
“Error executing Action: Error preprocessing query in clojure.lang.AFunction$1@66e0800b: Card 366 does not exist or belongs to another database.”

The part of the error saying the card belongs to another database doesn’t make sense, because I’m trying to trigger the action from the same model (I also tried from a dashboard and got the same error).

Thank you very much in advance.


Your custom action's query is incorrect--you can't target a question or model with an UPDATE command. Change {{#366}} in the query (just after UPDATE) to the table you are applying the update to.

For example, it should read something like

UPDATE mytable
SET motherslastname = {{apellidonmadre}}
where rut = {{rut}}

where mytable is the table in the database containing the records you are trying to update.

Thanks for your answer, there is a possibilitie to make an update over a model? because I don´t want to create a pshically table.
Thanks in advance.

The model was defined from a physical table, so one had to be made somewhere.

Metabase doesn't know how to transform UPDATE commands against models into physical table UPDATEs. It's non-trivial to look at a SELECT query and determine an UPDATE that will work for it without having deep knowledge of the schema and design of the table.

In some databases you can create updateable views that can abstract away details if needed.