Delete user from metabase db

I want to delete a user from the metabase database.
So not only deactivate, but I really want it completely gone.

Would it be enough to delete it from the table core_user ?
Nothing else has happend with the account, so there is nothing linked to it from the reporting side.
Account was just created and linked to a role group.

Hi @cobalt
You can delete users completely in core_user - there is a lot of constraints to group*, collection*, activity, report_* and other tables, so make sure those are resolved too, since you’ll otherwise leave the application database in a corrupted state, which might be a problem in the future during upgrades.

Hmm seems a bit risky then if I oversee one record/table.

@cobalt There should be constraints prohibiting you from deleting the user before the constraints.
But any manual changes to the application database needs to be done with a lot of caution.

So there is a delete button normally?

@cobalt No, there’s no actual delete API:
https://github.com/metabase/metabase/blob/master/docs/api-documentation.md#delete-apiuserid
How about you just rename the user and change the email, and then deactivate?

That’s idd what I did for now.
Seems like a safer thing to do.

hello @flamber is it possible delete the user (using api) that the last login is more than 6 months?

@herrsiqueira I don't understand. Like I wrote; there is not a way to delete a user via the API.
If you need to delete the users, then you would have to do that in the database.

Sorry @flamber,

I want to implement a code in python using the api to disable all users who have not logged in for more than 6 months.
Is there anything in the api to help me with this?

@herrsiqueira Yes, you would get all the metadata of the users:
https://github.com/metabase/metabase/blob/master/docs/api-documentation.md#get-apiuser
And then loop through all of them and deactivate the ones that hasn't logged in for 6 months:
https://github.com/metabase/metabase/blob/master/docs/api-documentation.md#delete-apiuserid

hello @flamber
is there any query that return de DataID (like the picture) and not the Name?

@herrsiqueira Yes, https://github.com/metabase/metabase/blob/master/docs/api-documentation.md#get-apidatabaseid
The best way to learn the API, is to just use Metabase while having your browser developer Network-tab open and looking at the request, and what data is being send/received.

Please create new topics instead of just replying within existing topics that are completely unrelated.

thanks @flamber and sorry about the post