Beispiel #1
0
def test_cross_joins(local_engine_empty):
    _mount_postgres(PG_MNT)
    _mount_mongo(MG_MNT)
    assert (
        local_engine_empty.run_sql("""SELECT "test/pg_mount".fruits.fruit_id,
                 test_mg_mount.stuff.name,
                 "test/pg_mount".fruits.name as spirit_fruit
           FROM "test/pg_mount".fruits 
           JOIN test_mg_mount.stuff 
           ON "test/pg_mount".fruits.fruit_id = test_mg_mount.stuff.duration"""
                                   ) == [(2, "James", "orange")])
Beispiel #2
0
def test_mount_force_schema(local_engine_empty):
    _mount_postgres(
        PG_MNT,
        tables={"fruits": {
            "schema": {
                "fruit_id": "character varying"
            }
        }})
    assert get_engine().table_exists(PG_MNT.to_schema(), "fruits")
    assert get_engine().get_full_table_schema(
        PG_MNT.to_schema(), "fruits") == [
            TableColumn(1, "fruit_id", "character varying", False, None)
        ]
Beispiel #3
0
def test_mount_partial(local_engine_empty):
    _mount_postgres(PG_MNT, tables=["fruits"])
    assert get_engine().table_exists(PG_MNT.to_schema(), "fruits")
    assert not get_engine().table_exists(PG_MNT.to_schema(), "vegetables")
Beispiel #4
0
def test_mount_unmount(local_engine_empty):
    _mount_postgres(PG_MNT)
    assert (1, "apple") in get_engine().run_sql("""SELECT * FROM "test/pg_mount".fruits""")
    PG_MNT.delete()
    assert not get_engine().schema_exists(PG_MNT.to_schema())