Skip to content
Merged
Show file tree
Hide file tree
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
158 changes: 158 additions & 0 deletions .check_expression_baseline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
{
"entries": {
"1ed29036faf46a82": 2,
"27df13aa97e8f397": 2,
"3ed8ec0dc8194acc": 4,
"558ff589c7816db1": 1,
"585e34e100bdd398": 2,
"5ae1f677effad792": 1,
"93794eba1e84abdf": 1,
"96b19532f33d13aa": 1,
"acf9357340ec4b2e": 1,
"b6b323654639d84e": 1,
"b865f866dd599e89": 1,
"c8cba7dd7eafe9d9": 2,
"d3b3e3d27e7e76ad": 2,
"e62ffd51c027b61a": 4,
"edb1d2cceabc1515": 1,
"f1167066a3660d0e": 1
},
"findings": [
{
"found": "if_not_exists: Optional[bool]",
"path": "src/rhosocial/activerecord/backend/impl/mysql/expression/alter_column.py",
"rule": "ED-10.2"
},
{
"found": "invisible: Optional[bool]",
"path": "src/rhosocial/activerecord/backend/impl/mysql/expression/column.py",
"rule": "ED-10.2"
},
{
"found": "invisible: Optional[bool]",
"path": "src/rhosocial/activerecord/backend/impl/mysql/expression/column.py",
"rule": "ED-10.2"
},
{
"found": "kwargs: Any",
"path": "src/rhosocial/activerecord/backend/impl/mysql/expression/json.py",
"rule": "ED-KWARGS"
},
{
"found": "getattr(action, \"if_not_exists\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/ddl_column.py",
"rule": "ED-11.2"
},
{
"found": "getattr(action, \"after\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/ddl_column.py",
"rule": "ED-11.2"
},
{
"found": "getattr(action, \"if_exists\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/ddl_column.py",
"rule": "ED-11.2"
},
{
"found": "getattr(action, \"if_exists\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/ddl_column.py",
"rule": "ED-11.2"
},
{
"found": "getattr(action.operation, \"value\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/ddl_column.py",
"rule": "ED-11.2"
},
{
"found": "getattr(action, \"new_value\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/ddl_column.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"table_options\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/ddl_table.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"table_options\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/ddl_table.py",
"rule": "ED-11.2"
},
{
"found": "getattr(table_options, \"comment\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/ddl_table.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"options\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/maintenance.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"option\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/maintenance.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"options\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/maintenance.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"subpartition_by\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"partitions\", [])",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"subpartition_by\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"partitions\", [])",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"subpartition_by\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"partitions\", [])",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"subpartition_by\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"partitions\", [])",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"partitions_count\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
},
{
"found": "getattr(expr, \"partitions_count\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
},
{
"found": "getattr(definition, \"subpartition_definitions\", None)",
"path": "src/rhosocial/activerecord/backend/impl/mysql/mixins/partition.py",
"rule": "ED-11.2"
}
],
"format": 1
}
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ jobs:

- name: Install activerecord and testsuite
run: |
pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@feature/error-taxonomy" # NOSONAR
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@feature/error-taxonomy" # NOSONAR
pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" # NOSONAR
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" # NOSONAR

- name: Install dependencies
run: |
Expand Down Expand Up @@ -247,8 +247,8 @@ jobs:

- name: Install activerecord and testsuite
run: |
pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@feature/error-taxonomy" # NOSONAR
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@feature/error-taxonomy" # NOSONAR
pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" # NOSONAR
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" # NOSONAR

- name: Install dependencies
run: |
Expand Down Expand Up @@ -354,8 +354,8 @@ jobs:

- name: Install activerecord and testsuite
run: |
pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@feature/error-taxonomy" # NOSONAR
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@feature/error-taxonomy" # NOSONAR
pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30" # NOSONAR
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17" # NOSONAR

- name: Install dependencies
run: |
Expand Down
10 changes: 8 additions & 2 deletions tests/providers/basic_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
class SyncTestUser(ActiveRecord):
"""Sync test user model for connection pool tests."""

__table_name__ = "test_users"
@classmethod
def table_name(cls):
return "test_users"

id: Optional[int] = None
name: str
email: str
Expand All @@ -30,7 +33,10 @@ class SyncTestUser(ActiveRecord):
class AsyncTestUser(AsyncActiveRecord):
"""Async test user model for connection pool tests."""

__table_name__ = "test_users"
@classmethod
def table_name(cls):
return "test_users"

id: Optional[int] = None
name: str
email: str
Expand Down
10 changes: 8 additions & 2 deletions tests/providers/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ def _event_model(self, backend):
table_name = self.TABLE_NAME

class PartitionEvent(ActiveRecord):
__table_name__ = table_name
@classmethod
def table_name(cls):
return table_name

__backend__ = backend
c: ClassVar[FieldProxy] = FieldProxy()

Expand All @@ -247,7 +250,10 @@ def _async_event_model(self, backend):
table_name = self.TABLE_NAME

class AsyncPartitionEvent(AsyncActiveRecord):
__table_name__ = table_name
@classmethod
def table_name(cls):
return table_name

__backend__ = backend
c: ClassVar[FieldProxy] = FieldProxy()

Expand Down
10 changes: 8 additions & 2 deletions tests/providers/query_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
class SyncQueryTestUser(ActiveRecord):
"""Sync test user model for query connection pool tests."""

__table_name__ = "test_users"
@classmethod
def table_name(cls):
return "test_users"

id: Optional[int] = None
name: str
email: str
Expand All @@ -30,7 +33,10 @@ class SyncQueryTestUser(ActiveRecord):
class AsyncQueryTestUser(AsyncActiveRecord):
"""Async test user model for query connection pool tests."""

__table_name__ = "test_users"
@classmethod
def table_name(cls):
return "test_users"

id: Optional[int] = None
name: str
email: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,14 @@ def apply(cls, new_class, field_name, annotation, metadata):


class DDLDeclarations:
__table_name__ = "ddl_source_orders"
__primary_key__ = ("tenant_key", "order_key")
@classmethod
def table_name(cls):
return "ddl_source_orders"

@classmethod
def primary_key(cls):
return ("tenant_key", "order_key")

__table_constraints__ = TABLE_CONSTRAINTS
__table_indexes__ = TABLE_INDEXES
_feature_handlers = [BackendColumnOptionsHandler]
Expand Down Expand Up @@ -243,8 +249,13 @@ class AsyncDDLSource(DDLDeclarations, AsyncActiveRecord):


class SingleKeyDeclarations:
__table_name__ = "ddl_source_single_key"
__primary_key__ = "record_pk"
@classmethod
def table_name(cls):
return "ddl_source_single_key"

@classmethod
def primary_key(cls):
return "record_pk"

record_id: Annotated[
int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@


class Indexed(ActiveRecord):
__table_name__ = "indexed"
@classmethod
def table_name(cls):
return "indexed"

id: int
email: Annotated[str, UseIndex("idx_indexed_email", unique=True)]
Expand All @@ -36,7 +38,7 @@ def _create_indexed_table():
dialect = mysql_dialect()
return CreateTableStatement(
dialect,
Table(dialect, Indexed.__table_name__),
Table(dialect, Indexed.table_name()),
columns=[
ColumnDefinition(dialect, "id", IntegerType(dialect)),
ColumnDefinition(dialect, "email", VarCharType(dialect, 255)),
Expand Down
Loading
Loading