def test_join_on_condition_and_condition(self): m = Table('foo').Join('bar').\ On().Field('foo.id').Op('=').Field('bar.foo_id').\ And().Field('foo.val').Op('<>').Field('bar.thing') self.assertEqual( m.render(), 'foo.join(bar, and_(foo.c.id == bar.c.foo_id, ' 'foo.c.val != bar.c.thing))')
def test_join_on_condition_join_table(self): m = Table('foo').Join('bar').\ On().Field('foo.id').Op('=').Field('bar.foo_id').\ Join('wumbo').On().Field('foo.id').Op('=').Field('wumbo.foo_id') self.assertEqual( m.render(), 'foo.join(bar, foo.c.id == bar.c.foo_id)' '.join(wumbo, foo.c.id == wumbo.c.foo_id)' )
def test_join_on_condition_and_condition(self): m = Table('foo').Join('bar').\ On().Field('foo.id').Op('=').Field('bar.foo_id').\ And().Field('foo.val').Op('<>').Field('bar.thing') self.assertEqual( m.render(), 'foo.join(bar, and_(foo.c.id == bar.c.foo_id, ' 'foo.c.val != bar.c.thing))' )
def test_join_on_condition_and_condition(self): m = ( Table("foo") .Join("bar") .On() .Field("foo.id") .Op("=") .Field("bar.foo_id") .And() .Field("foo.val") .Op("<>") .Field("bar.thing") ) self.assertEqual( m.render(), "foo.join(bar, and_(foo.c.id == bar.c.foo_id, " "foo.c.val != bar.c.thing))", )
def test_join_on_condition_join_table(self): m = ( Table("foo") .Join("bar") .On() .Field("foo.id") .Op("=") .Field("bar.foo_id") .Join("wumbo") .On() .Field("foo.id") .Op("=") .Field("wumbo.foo_id") ) self.assertEqual( m.render(), "foo.join(bar, foo.c.id == bar.c.foo_id)" ".join(wumbo, foo.c.id == wumbo.c.foo_id)", )
def test_join_on_condition(self): m = Table("foo").Join("bar").On().Field("foo.id").Op("=").Field("bar.foo_id") self.assertEqual(m.render(), "foo.join(bar, foo.c.id == bar.c.foo_id)")
def test_joined_table(self): m = Table("A").Join("B") self.assertEqual(m.render(), "A.join(B)") m = Table("A").Join("B").Join("C").Join("D") self.assertEqual(m.render(), "A.join(B).join(C).join(D)")
def test_joined_table(self): m = Table('A').Join('B') self.assertEqual(m.render(), 'A.join(B)') m = Table('A').Join('B').Join('C').Join('D') self.assertEqual(m.render(), 'A.join(B).join(C).join(D)')