Skip to content

Commit 4871ac7

Browse files
committed
Add __init__.py for sqlalchemy integration tests
1 parent 5ee014a commit 4871ac7

2 files changed

Lines changed: 26 additions & 11 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License").
4+
# You may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.

tests/integration/container/sqlalchemy/test_sqlalchemy_basic.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
from typing import Any
2222

2323
import pytest
24-
from sqlalchemy.orm import declarative_base, Mapped, mapped_column
25-
from sqlalchemy import Column, Integer, String
24+
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
25+
from sqlalchemy import Column, Integer, String, Boolean, DateTime
2626

2727
from tests.integration.container.utils.rds_test_utility import RdsTestUtility
2828
from ..utils.conditions import (disable_on_features, enable_on_deployments,
@@ -52,18 +52,20 @@ def rds_utils(self):
5252
@pytest.fixture(scope='class')
5353
def sqlalchemy_models(self, sqlalchemy_setup):
5454
"""Create SQLAlchemy models after SQLAlchemy is set up"""
55+
#Base = declarative_base()
5556

56-
Base = declarative_base()
57+
class Base(DeclarativeBase):
58+
pass
5759

58-
class TestModel(Base):
59-
"""Basic test model for SQLAlchemy ORM functionality"""
60-
__tablename__ = 'sqlalchemy_test_model'
60+
class TestModel(Base):
61+
"""Basic test model for SQLAlchemy ORM functionality"""
62+
__tablename__ = 'sqlalchemy_test_model'
6163

62-
name: Mapped[str] = mapped_column(String(100))
63-
email: Mapped[str] = mapped_column(String, primary_key=True)
64-
age: Mapped[int] = mapped_column(Integer)
65-
is_active: Mapped[bool] = mapped_column(Bool, server_default=True)
66-
created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now(), onupdate=func.now())
64+
name: Mapped[str] = mapped_column(String(100))
65+
email: Mapped[str] = mapped_column(String, primary_key=True)
66+
age: Mapped[int] = mapped_column(Integer)
67+
is_active: Mapped[bool] = mapped_column(Boolean)
68+
created_at: Mapped[datetime] = mapped_column(DateTime)
6769

6870
'''
6971
class DataTypeModel(models.Model):

0 commit comments

Comments
 (0)