Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions test/system/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
Loading