Commit 828c5e5
authored
cowork-bot: automated improvements (cowork/improve-json2sql-2) (#36)
* cowork-bot: emit valid SQL for mixed-type columns and empty/nested-only roots
Type inference now collapses a column whose values mix incompatible types
(e.g. a string and an integer) to TEXT instead of keeping the first-seen
numeric type. Previously this produced INSERT statements with a quoted string
literal in a numeric column, which Postgres/MySQL reject as invalid SQL. A
NULL value is treated as "unset" so a column that first sees NULL can still
take a concrete type when a non-NULL value arrives (e.g. [null, 42] ->
INTEGER), and an all-NULL column resolves to TEXT.
convert()/generate_schema() no longer emit an invalid `CREATE TABLE "x" ();`
or `INSERT INTO "x" () VALUES ();` for an empty object or a root whose only
content is nested arrays (flatten). They now emit only the valid child
tables, or an explicit comment when nothing can be generated, instead of a
silent green no-op.
- src/json2sql/converter.py: add _infer_type/_merge_type; skip empty root tables
- tests/test_edge_cases.py: correct the two tests that encoded the old buggy
widening behavior
- tests/test_type_inference.py: regression tests for mixed-type, NULL, and
empty/nested-only-root cases across all three dialects
- .github/workflows/cowork-auto-pr.yml: seed server-side PR opener
* fix: remove false PyPI badge and broken json2sql-cli install commands
* chore: gitignore scratch file _run_tests.py (cron artifact, not project code)
* chore: gitignore additional scratch files (_audit_reqs.txt, _pr_body.md)1 parent a6a3e2a commit 828c5e5
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
76 | 81 | | |
77 | 82 | | |
0 commit comments