Conversation
Bumps [black](https://github.com/psf/black) from 23.12.1 to 24.1.1. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](psf/black@23.12.1...24.1.1) --- updated-dependencies: - dependency-name: black dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
…DDB/create_SQLModels
lord-haffi
left a comment
There was a problem hiding this comment.
Sorry, hatte das vor ein paar Tage reviewed, war aber alles noch auf Pending - vergessen auf den grünen Button zu klicken 🙄
Versuch gerne mal den Decimal-Regex wegzulassen. Eigentlich sollte der Bug gefixt sein. Ansonsten passt das so für mich, gebe dir schonmal nen Approve 👍
| def make_decimal(field: str) -> str: | ||
| """ | ||
| turns Union type float or str into Decimal type | ||
| """ | ||
| return re.sub(r"float \| str", "Decimal", field) |
There was a problem hiding this comment.
Mittlerweile überflüssig. Der Bug ist behoben, der Typ wird nun nicht mehr in float | str übersetzt, sondern direkt in Decimal.
| # add_relation, relation_imports = create_sql_field( | ||
| # field, schema_metadata.class_name, namespace, add_relation, relation_imports | ||
| # ) |
| if "number" in str(val) and "string" in str(val): | ||
| relation_imports[schema_metadata.class_name + "ADD"]["Decimal"] = "decimal" | ||
| if "array" in str(val) and "$ref" not in str(val): | ||
| add_relation, relation_imports = create_sql_list( | ||
| field, schema_metadata.class_name, namespace, add_relation, relation_imports | ||
| ) | ||
| del_fields.append(field) | ||
| if "$ref" in str(val): # or "array" in str(val): | ||
| add_relation, relation_imports = create_sql_field( | ||
| field, schema_metadata.class_name, namespace, add_relation, relation_imports | ||
| ) | ||
| del_fields.append(field) |
There was a problem hiding this comment.
Generell wäre es natürlich schöner, expliziter ranzugehen, als in der String-Übersetzung zu suchen. Im BO4E-Schema-Tool hab ich z.B. Schemas hinterlegt, um diese JSON-Schemas in eine Python-Objekt-Struktur zu überführen. Die kann man dann besser und sicherer analysieren.
Passt jetzt so für mich, nur fürs nächste Mal als Tipp ;)
Co-authored-by: Leon Haffmans <49658102+lord-haffi@users.noreply.github.com>
Co-authored-by: Leon Haffmans <49658102+lord-haffi@users.noreply.github.com>
Co-authored-by: Leon Haffmans <49658102+lord-haffi@users.noreply.github.com>
Co-authored-by: Leon Haffmans <49658102+lord-haffi@users.noreply.github.com>
No description provided.