This repository was archived by the owner on Mar 13, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ from typing import Optional
1516from 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
You can’t perform that action at this time.
0 commit comments