-
Notifications
You must be signed in to change notification settings - Fork 1
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
Nas2 #32
Nas2 #32
Conversation
acacore/database/column.py
Outdated
@@ -95,7 +87,7 @@ def _schema_to_column(name: str, schema: dict, defs: Optional[dict[str, dict]] = | |||
elif schema_type in ("object", "array"): | |||
sql_type = "text" | |||
to_entry = lambda o: dumps(dump_object(o), default=str) | |||
from_entry = lambda x: from_entry_func(x) | |||
from_entry = lambda x: loads(x) if x else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Det burde være:
None if x is in (None, '') else loads(x)
Hvis du bruger bare if x
, bliver alle "falsy" væredier (fx. 0) konverteret til None. Tomme strings og NULL værdier er okay, men alle de ændre, der ikke kan parses som JSON, burde raise en exception, fordi de returneres fra databasen kun hvis noget gik galt.
acacore/database/column.py
Outdated
@@ -104,7 +96,7 @@ def _schema_to_column(name: str, schema: dict, defs: Optional[dict[str, dict]] = | |||
if not schema_any_of[0] or len(schema_any_of) > 2: | |||
sql_type = "text" | |||
to_entry = lambda o: dumps(dump_object(o), default=str) | |||
from_entry = lambda x: from_entry_func(x) | |||
from_entry = lambda x: loads(x) if x else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Det samme her
No longer relevant. |
No description provided.