#!/usr/bin/env python import os from sqlalchemy import create_engine db_base_path = os.environ['DB_BASE_PATH'] engine = create_engine(db_base_path) started = False while not started: try: engine.execute("SELECT 1") started = True except Exception as inst: pass