Skip to content

cowork-bot: automated improvements (cowork/improve-json2sql-3) - #39

Open
github-actions[bot] wants to merge 2 commits into
mainfrom
cowork/improve-json2sql-3
Open

cowork-bot: automated improvements (cowork/improve-json2sql-3)#39
github-actions[bot] wants to merge 2 commits into
mainfrom
cowork/improve-json2sql-3

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated improvement PR from the Cowork repo-improver rotation (one coherent senior-dev improvement per run; see individual commit messages). Subsequent runs push additional commits to this PR rather than opening new ones.

…s carry arrays

Grouping children per key so convert()/generate_schema() emit exactly one
CREATE TABLE per child table, with every child row linked to its own parent
FK (previously duplicate CREATE TABLEs and dropped rows).
When flattening nested arrays, the FK column in the child table must match
the parent table's primary key column name and type. Previously the code
preferred 'name' over explicit ID fields like 'user_id' or 'users_id',
causing a type mismatch (TEXT FK vs INTEGER PK).

New priority order for parent reference key:
1. 'id' (generic primary key)
2. '{parent_table}_id' (table-specific, e.g., 'users_id')
3. Any key ending in '_id' found in parent objects (e.g., 'user_id')
4. 'name' (fallback only when no ID-like field exists)

Added 12 regression tests covering all three dialects (Postgres, MySQL, SQLite).
@github-actions

Copy link
Copy Markdown
Contributor Author

🤖 Automated Code Review

✅ Ruff Lint — No issues

⚠️ Ruff Format — Formatting needed

unformatted: File would be reformatted
 --> conftest.py:2:1
  |
1 | """pytest configuration — add project src to Python path and skip rate limits."""
2 +
3 | import os
  |

unformatted: File would be reformatted
   --> src/json2sql/cli.py:17:19
    |
16  |
    -     warnings.warn(
    -         "revenueholdings-license not installed; license checks skipped", stacklevel=2
    -     )
17  +     warnings.warn("revenueholdings-license not installed; license checks skipped", stacklevel=2)
18  |
--------------------------------------------------------------------------------
45  |     global _require_license_strict
    -     _require_license_strict = require_license_flag or bool(
    -         os.environ.get("REVENUEHOLDINGS_REQUIRE_LICENSE")
    -     )
46  +     _require_license_strict = require_license_flag or bool(os.environ.get("REVENUEHOLDINGS_REQUIRE_LICENSE"))
47  |
--------------------------------------------------------------------------------
59  |             typer.echo(
    -                 "Error: revenueholdings-license is not installed. "
    -                 "Install it with: pip install revenueholdings-license",
60  +                 "Error: revenueholdings-license is not installed. Install it with: pip install revenueholdings-license",
61  |                 err=True,

✅ Secret Detection — Clean

✅ Large Files — Within limits

📊 Diff Stats — 9 file(s) changed

 src/json2sql.egg-info/PKG-INFO             | 129 -----------------------------
 src/json2sql.egg-info/SOURCES.txt          |  14 ----
 src/json2sql.egg-info/dependency_links.txt |   1 -
 src/json2sql.egg-info/entry_points.txt     |   2 -
 src/json2sql.egg-info/requires.txt         |   9 --
 src/json2sql.egg-info/top_level.txt        |   1 -
 src/json2sql/converter.py                  |  55 +++++++++---
 tests/test_edge_cases.py                   |  38 +++++++++
 tests/test_type_inference.py               |  69 +++++++++++++++
 9 files changed, 152 insertions(+), 166 deletions(-)

Verdict: ⚠️ Warnings — Lint/format issues found. Recommend fixing before merge.

Automated by Coding-Dev-Tools/.github reusable workflow.

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.

1 participant