psql -U kodekloud_aim -d kodekloud_db8 -h 127.0.0.1 -W ## Change name according to question
#### for the test on mode postgres u have
## conninfo
## l
## dg+
## q # to quit
psql -U kodekloud_gem -d kodekloud_db10 -h localhost -W
from sqlalchemy import event
from sqlalchemy import create_engine
engine = create_engine("postgresql+psycopg2://scott:tiger@host/dbname")
@event.listens_for(engine, "connect", insert=True)
def set_search_path(dbapi_connection, connection_record):
existing_autocommit = dbapi_connection.autocommit
dbapi_connection.autocommit = True
cursor = dbapi_connection.cursor()
cursor.execute("SET SESSION search_path='%s'" % schema_name)
cursor.close()
dbapi_connection.autocommit = existing_autocommit