I am using SQLAlchemy to generate tables in a specific schema in a PostgreSQL database. If the schema does not exist, I want to create it. I know the PostgreSQL query to check for the existence of the schema:
SELECT exists(select schema_name FROM information_schema.schemata WHERE schema_name = 'foo')
but I want to know how I should handle this using SQLAlchemy.