コード例 #1
0
def sqlalchemy_query_store_specified_return_type(titanic_sqlite_db):
    # For the purpose of this test, just steal the engine from a dataset
    credentials = {"engine": titanic_sqlite_db.engine}
    return SqlAlchemyQueryStore(
        credentials=credentials,
        queries={
            "q1": "SELECT DISTINCT PClass FROM titanic;",
            "q2": {
                "query": "SELECT DISTINCT PClass  FROM titanic;",
                "return_type": "list",
            },
            "q3": {"query": "SELECT count(*) FROM titanic;", "return_type": "scalar"},
            "error_query": {
                "query": "SELECT count(*) FROM titanic;",
                "return_type": "not_list_or_scalar",
            },
        },
    )
コード例 #2
0
def basic_sqlalchemy_query_store(titanic_sqlite_db):
    # For the purpose of this test, just steal the engine from a dataset
    credentials = {"engine": titanic_sqlite_db.engine}
    return SqlAlchemyQueryStore(
        credentials=credentials,
        queries={"q1": "SELECT count(*) FROM titanic;"})
コード例 #3
0
def test_basic_sqlalchemy_query_store_connection_string(
    titanic_sqlite_db_connection_string, ):
    credentials = {"connection_string": titanic_sqlite_db_connection_string}
    return SqlAlchemyQueryStore(
        credentials=credentials,
        queries={"q1": "SELECT DISTINCT PClass FROM titanic;"})