Sql alchemy using connection string with kerberos and impala

Viewed 16

Actually I use sql alchemy and impala to connect database with creator like :

def conn():
    return connect(host=CONNECTION_PARAMETERS["HOST"],
               port=CONNECTION_PARAMETERS["PORT"],
               database=CONNECTION_PARAMETERS["DATABASE"],
               use_ssl=CONNECTION_PARAMETERS["USE_SSL"],
               auth_mechanism=CONNECTION_PARAMETERS["AUTH_MECANISM"])


def get_bde_db():
    engine = create_engine('impala://', creator=conn,
                            pool_size=2,
                            pool_pre_ping=True,
                            pool_recycle=3600)
    user_session_local = sessionmaker(autocommit=False, autoflush=False, bind=engine)
    db = user_session_local()
    try:
        yield db
    finally:
        db.close()

But I want to change it, stop use the creator parameter and build a connection string in the create_engine. Is it possible to generate a url, and use url parameter ? I use impala, kerberos, ssl

0 Answers
Related