Skip to content

Commit 828c5e5

Browse files
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

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,10 @@ research/
7373
fixtures/generated/
7474
.ruff_cache/
7575

76+
# Scratch/debug files (cron artifacts)
77+
_run_tests.py
78+
_audit_reqs.txt
79+
_pr_body.md
80+
7681
# Added by release-prep
7782
node_modules

0 commit comments

Comments
 (0)