Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always create a pk primary auto-incrementing key #39

Merged
merged 30 commits into from
Sep 30, 2024
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
627dea1
Refactor web docs layout and improve content (#36)
seapagan Sep 28, 2024
37b213f
required modifications to make 'pk' non-optional
seapagan Sep 30, 2024
3258799
use pydantic mypy plugin
seapagan Sep 30, 2024
35c2969
fix mypy in pre-commit
seapagan Sep 30, 2024
9c99d61
wip on fixing tests
seapagan Sep 30, 2024
82b6208
make pk non-optional and default to 0
seapagan Sep 30, 2024
58858b9
add pytest hook to clear screen before each test run
seapagan Sep 30, 2024
b4b7d70
ensure insert fails on duplicate pk
seapagan Sep 30, 2024
ac41411
fix final existing tests
seapagan Sep 30, 2024
44cf95b
add specific model unit tests
seapagan Sep 30, 2024
9aa1c77
complete test coverage of changed code
seapagan Sep 30, 2024
a2f3861
fix last mypy issue
seapagan Sep 30, 2024
714e44b
add missing docstrings
seapagan Sep 30, 2024
b5f1262
update docs for pk changes
seapagan Sep 30, 2024
e904bfc
fix docs re update() method
seapagan Sep 30, 2024
12c23b2
required modifications to make 'pk' non-optional
seapagan Sep 30, 2024
8078178
use pydantic mypy plugin
seapagan Sep 30, 2024
d6c1d71
fix mypy in pre-commit
seapagan Sep 30, 2024
03727df
wip on fixing tests
seapagan Sep 30, 2024
04aa3ee
make pk non-optional and default to 0
seapagan Sep 30, 2024
6164250
add pytest hook to clear screen before each test run
seapagan Sep 30, 2024
eef5abe
ensure insert fails on duplicate pk
seapagan Sep 30, 2024
153fa2b
fix final existing tests
seapagan Sep 30, 2024
53f0f67
add specific model unit tests
seapagan Sep 30, 2024
55e9fd8
complete test coverage of changed code
seapagan Sep 30, 2024
358d705
fix last mypy issue
seapagan Sep 30, 2024
607a65e
add missing docstrings
seapagan Sep 30, 2024
9e18cbb
update docs for pk changes
seapagan Sep 30, 2024
2315d01
fix docs re update() method
seapagan Sep 30, 2024
c64cbfe
Merge branch 'no-optional-pk' of github.com:seapagan/sqliter-py into …
seapagan Sep 30, 2024
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
Prev Previous commit
Next Next commit
fix last mypy issue
Signed-off-by: Grant Ramsay <seapagan@gmail.com>
seapagan committed Sep 30, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit a2f3861c6a70f87f2e349f532ef755444e623589
4 changes: 2 additions & 2 deletions sqliter/model/model.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
from __future__ import annotations

import re
from typing import Any, Optional, TypeVar, Union, get_args, get_origin
from typing import Any, Optional, TypeVar, Union, cast, get_args, get_origin

from pydantic import BaseModel, ConfigDict, Field

@@ -87,7 +87,7 @@ def model_validate_partial(cls: type[T], obj: dict[str, Any]) -> T:
else:
converted_obj[field_name] = field_type(value)

return cls.model_construct(**converted_obj)
return cast(T, cls.model_construct(**converted_obj))

@classmethod
def get_table_name(cls) -> str:

Unchanged files with check annotations Beta

from sqliter.model.model import BaseDBModel
"""Test the Model and it's methods."""

Check warning on line 7 in tests/test_model.py

Codacy Production / Codacy Static Code Analysis

tests/test_model.py#L7

String statement has no effect
class TestBaseDBModel: