Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Commit e4e8cd5

Browse files
authored
test: add test with 'roles' table (#520)
* test: add test with 'roles' table Add a test that verifies that a table with the same name as a system view can be used. * chore: fix linting
1 parent 4b24f33 commit e4e8cd5

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

test/system/test_basics.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from typing import Optional
1516
from sqlalchemy import (
1617
text,
1718
Table,
@@ -90,6 +91,30 @@ def test_reflect(self, connection):
9091
eq_(1, len(dialect_options["storing"]))
9192
eq_("alternative_name", dialect_options["storing"][0])
9293

94+
def test_table_name_overlapping_with_system_table(self, connection):
95+
class Base(DeclarativeBase):
96+
pass
97+
98+
class Role(Base):
99+
__tablename__ = "roles"
100+
id: Mapped[int] = mapped_column(Integer, primary_key=True)
101+
name: Mapped[str] = mapped_column(String(100), nullable=True)
102+
type: Mapped[str] = mapped_column(String(100), nullable=True)
103+
description: Mapped[Optional[str]] = mapped_column(String(512))
104+
105+
engine = connection.engine
106+
Base.metadata.create_all(engine)
107+
108+
with Session(engine) as session:
109+
role = Role(
110+
id=1,
111+
name="Test",
112+
type="Test",
113+
description="Test",
114+
)
115+
session.add(role)
116+
session.commit()
117+
93118
def test_orm(self, connection):
94119
class Base(DeclarativeBase):
95120
pass

0 commit comments

Comments
 (0)