def get_conn(db, dbs=None, echo=True, reconnect=False, use_jdbc=False, conn_expire_min=10, spark_hive=False) -> DBConn:
    global conns
    dbs = (dbs if dbs else get_databases())
    profile = get_profile()
    db_dict = struct(dbs[db])
    if ((db_dict.type.lower() == 'hive') and spark_hive):
        db_dict.type = 'spark'
    use_jdbc = (True if (use_jdbc or (('use_jdbc' in db_dict) and db_dict['use_jdbc'])) else use_jdbc)
    if ((db in conns) and (not reconnect)):
        if (((now() - conns[db].last_connect).total_seconds() / 60) < conn_expire_min):
            return conns[db]
    if use_jdbc:
        log(('*USING JDBC for ' + db))
        from .jdbc import JdbcConn
        conn = JdbcConn(db_dict, profile=profile)
    elif (db_dict.type.lower() == 'oracle'):
        from .oracle import OracleConn
        conn = OracleConn(db_dict, echo=echo)
    elif (db_dict.type.lower() == 'spark'):
        from .spark import SparkConn
        conn = SparkConn(db_dict, echo=echo)
    elif (db_dict.type.lower() == 'hive'):
        from .hive import HiveConn, Beeline
        if (('use_beeline' in db_dict) and db_dict.use_beeline):
            conn = Beeline(db_dict, echo=echo)
        else:
            conn = HiveConn(db_dict, echo=echo)
    elif (db_dict.type.lower() in ('postgresql', 'redshift')):
        from .postgresql import PostgreSQLConn
        conn = PostgreSQLConn(db_dict, echo=echo)
    elif (db_dict.type.lower() == 'sqlserver'):
        from .sqlserver import SQLServerConn
        conn = SQLServerConn(db_dict, echo=echo)
    elif (db_dict.type.lower() == 'sqlite'):
        from .sqlite import SQLiteConn
        conn = SQLiteConn(db_dict, echo=echo)
    else:
        raise Exception(f'Type {db_dict.type} not handled!')
    conns[db] = conn
    return conn
def get_conn(db, dbs=None, echo=True, reconnect=False, use_jdbc=False, conn_expire_min=10, spark_hive=False) -> DBConn:
    global conns
    dbs = (dbs if dbs else get_databases())
    profile = get_profile()
    db_dict = struct(dbs[db])
    if ((db_dict.type.lower() == 'hive') and spark_hive):
        db_dict.type = 'spark'
    use_jdbc = (True if (use_jdbc or (('use_jdbc' in db_dict) and db_dict['use_jdbc'])) else use_jdbc)
    if ((db in conns) and (not reconnect)):
        if (((now() - conns[db].last_connect).total_seconds() / 60) < conn_expire_min):
            return conns[db]
    if use_jdbc:
        log(('*USING JDBC for ' + db))
        from .jdbc import JdbcConn
        conn = JdbcConn(db_dict, profile=profile)
    elif (db_dict.type.lower() == 'oracle'):
        from .oracle import OracleConn
        conn = OracleConn(db_dict, echo=echo)
    elif (db_dict.type.lower() == 'spark'):
        from .spark import SparkConn
        conn = SparkConn(db_dict, echo=echo)
    elif (db_dict.type.lower() == 'hive'):
        from .hive import HiveConn, Beeline
        if (('use_beeline' in db_dict) and db_dict.use_beeline):
            conn = Beeline(db_dict, echo=echo)
        else:
            conn = HiveConn(db_dict, echo=echo)
    elif (db_dict.type.lower() in ('postgresql', 'redshift')):
        from .postgresql import PostgreSQLConn
        conn = PostgreSQLConn(db_dict, echo=echo)
    elif (db_dict.type.lower() == 'sqlserver'):
        from .sqlserver import SQLServerConn
        conn = SQLServerConn(db_dict, echo=echo)
    elif (db_dict.type.lower() == 'sqlite'):
        from .sqlite import SQLiteConn
        conn = SQLiteConn(db_dict, echo=echo)
    else:
        raise Exception(f'Type {db_dict.type} not handled!')
    conns[db] = conn
    return conn