We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
class PyPIPackageModel(DbmModel): username: str class Config: table_name = "usernames" unique_together = ("username",)
class PyPIPackageModel(DbmModel): user: str class Config: table_name = "usernames" unique_together = ("user",) migration = True
def set_database_header(self): ann = get_obj_annotations(obj=self.model) db_headers = bytes(str({key: DATABASE_HEADER_MAPPING[value] for key, value in ann.items()}), "utf-8") with self as db: database_header: bytes | None if (database_header := db.get(DATABASE_HEADER_NAME, None)) is None or (database_header is not None and self.model._config.migration is True): db[DATABASE_HEADER_NAME] = db_headers else: # TODO: migrations assert database_header == db_headers, f"Database headers are not equal: '{database_header}' != '{db_headers}'" # type: ignore[str-bytes-safe] # noqa: E501 setattr(self, DATABASE_HEADER_NAME, ann)
The text was updated successfully, but these errors were encountered:
The place that makes operations on the db should be separated from the place that makes pythonic and the place that models the data.
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: