Function before (phyton, store procedure,etc.)

@wsca Okay, then it sounds like you should just create a View in the database, which Metabase will then see as a regular table.
Or you might be able to create what you need from Custom question, and then reusing that as a Saved Question.