File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -548,6 +548,10 @@ def __init__(
548
548
) -> None :
549
549
super ().__init__ (alias = alias )
550
550
self .name = name
551
+ if isinstance (table , str ):
552
+ # avoid circular import at load time
553
+ from pypika .queries import Table
554
+ table = Table (table )
551
555
self .table = table
552
556
553
557
def nodes_ (self ) -> Iterator [NodeT ]:
Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ def test_when_alias_specified(self):
15
15
self .assertEqual ('bar' , str (c1 .alias ))
16
16
17
17
18
+ class FieldInitTests (TestCase ):
19
+ def test_init_with_str_table (self ):
20
+ test_table_name = "test_table"
21
+ field = Field (name = "name" , table = test_table_name )
22
+ self .assertEqual (field .table , Table (name = test_table_name ))
23
+
24
+
18
25
class FieldHashingTests (TestCase ):
19
26
def test_tabled_eq_fields_equally_hashed (self ):
20
27
client_name1 = Field (name = "name" , table = Table ("clients" ))
You can’t perform that action at this time.
0 commit comments