diff --git a/test/system/test_basics.py b/test/system/test_basics.py index 171485b8..e3099912 100644 --- a/test/system/test_basics.py +++ b/test/system/test_basics.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Optional from sqlalchemy import ( text, Table, @@ -90,6 +91,30 @@ def test_reflect(self, connection): eq_(1, len(dialect_options["storing"])) eq_("alternative_name", dialect_options["storing"][0]) + def test_table_name_overlapping_with_system_table(self, connection): + class Base(DeclarativeBase): + pass + + class Role(Base): + __tablename__ = "roles" + id: Mapped[int] = mapped_column(Integer, primary_key=True) + name: Mapped[str] = mapped_column(String(100), nullable=True) + type: Mapped[str] = mapped_column(String(100), nullable=True) + description: Mapped[Optional[str]] = mapped_column(String(512)) + + engine = connection.engine + Base.metadata.create_all(engine) + + with Session(engine) as session: + role = Role( + id=1, + name="Test", + type="Test", + description="Test", + ) + session.add(role) + session.commit() + def test_orm(self, connection): class Base(DeclarativeBase): pass