Dynamic schema name

Yes, setting the variable inside the function works (for table names as well as for schema names). It’s also no problem to pass in a table name via the function head parameters.

My problem is passing in an Ecto schema name (not a table name) via the function head.

This works (inside the function):

schema_name = Account
Test.Repo.all(from a in schema_name, where: a.name == "ACME", select: a.id)

This I cannot get to work for a schema:

def test(schema_name) do
  Test.Repo.all(from a in schema_name, where: a.name == "ACME", select: a.id) 
end

P.S.: I don’t think one needs the pin before “ACME”, that seems to work fine as is also.