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

Nas2 #32

Closed
wants to merge 8 commits into from
Closed

Nas2 #32

wants to merge 8 commits into from

Conversation

ValdemarOtte
Copy link

No description provided.

@@ -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
Copy link
Member

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.

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Det samme her

@clausjuhl
Copy link
Member

No longer relevant.

@clausjuhl clausjuhl closed this Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants