def test_select_field_on_alias():
    result = compute_up(t.amount, select(s).limit(10).alias('foo'))
    assert normalize(str(select(result))) == normalize("""
        SELECT foo.amount
        FROM (SELECT accounts.name AS name, accounts.amount AS amount, accounts.id AS id
              FROM accounts
              LIMIT :param_1) as foo""")
Пример #2
0
def test_select_field_on_alias():
    result = compute_up(t.amount, select(s).limit(10).alias('foo'))
    assert normalize(str(select(result))) == normalize("""
        SELECT foo.amount
        FROM (SELECT accounts.name AS name, accounts.amount AS amount, accounts.id AS id
              FROM accounts
              LIMIT :param_1) as foo""")
def test_field_access_on_engines():
    engine = sa.create_engine('sqlite:///:memory:')
    metadata = sa.MetaData(engine)
    name = sa.Table('name', metadata,
             sa.Column('id', sa.Integer),
             sa.Column('name', sa.String),
             )
    name.create()

    city = sa.Table('city', metadata,
             sa.Column('id', sa.Integer),
             sa.Column('city', sa.String),
             sa.Column('country', sa.String),
             )
    city.create()

    s = symbol('s', discover(engine))
    result = compute_up(s.city, engine)
    assert isinstance(result, sa.Table)
    assert result.name == 'city'
Пример #4
0
def test_field_access_on_engines():
    engine = sa.create_engine('sqlite:///:memory:')
    metadata = sa.MetaData(engine)
    name = sa.Table('name', metadata,
             sa.Column('id', sa.Integer),
             sa.Column('name', sa.String),
             )
    name.create()

    city = sa.Table('city', metadata,
             sa.Column('id', sa.Integer),
             sa.Column('city', sa.String),
             sa.Column('country', sa.String),
             )
    city.create()

    s = symbol('s', discover(engine))
    result = compute_up(s.city, engine)
    assert isinstance(result, sa.Table)
    assert result.name == 'city'
Пример #5
0
def test_field_access_on_engines(data):
    s, engine = data['s'], data['engine']
    result = compute_up(s.city, engine)
    assert isinstance(result, sa.Table)
    assert result.name == 'city'
Пример #6
0
def test_field_access_on_engines(data):
    s, engine = data['s'], data['engine']
    result = compute_up(s.city, engine)
    assert isinstance(result, sa.Table)
    assert result.name == 'city'