diff --git a/pypika/terms.py b/pypika/terms.py index 0a077b57..a277e1a5 100644 --- a/pypika/terms.py +++ b/pypika/terms.py @@ -654,6 +654,7 @@ def __init__( if isinstance(table, str): # avoid circular import at load time from pypika.queries import Table + table = Table(table) self.table = table diff --git a/pypika/tests/test_terms.py b/pypika/tests/test_terms.py index 607c4c01..4c7590df 100644 --- a/pypika/tests/test_terms.py +++ b/pypika/tests/test_terms.py @@ -20,7 +20,7 @@ def test_init_with_str_table(self): test_table_name = "test_table" field = Field(name="name", table=test_table_name) self.assertEqual(field.table, Table(name=test_table_name)) - + class FieldHashingTests(TestCase): def test_tabled_eq_fields_equally_hashed(self):