fix: insider Binder error on default --prefer auto (#42)#56
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a733fd0a3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #42:
uv run edgarq insider AAPL --form 4 --no-cachecrashed withBinder Error: Referenced column "ISSUERCIK" not foundon the default--prefer autopath.Two tangled root causes addressed:
View DDL vs parquet schema drift. The
_run_sql_pathquery assumed all columns lived oninsider_transactions_nonderiv, but the real SEC form345 schema is normalised across three tables joined onACCESSION_NUMBER:insider_submissions—ISSUERCIK(BIGINT),FILING_DATE(VARCHARDD-MON-YYYY),DOCUMENT_TYPEinsider_transactions_nonderiv—SECURITY_TITLE,TRANS_DATE,TRANS_CODE,TRANS_SHARES,TRANS_PRICEPERSHARE,TRANS_ACQUIRED_DISP_CD,SHRS_OWND_FOLWNG_TRANSreporting_owners—RPTOWNERNAME,RPTOWNER_RELATIONSHIP(free text likeDirector,Officer,TenPercentOwner),RPTOWNER_TITLERewrote the SQL to select+filter via
insider_submissionsand join transactions/owners, with date conversion viastrptime/strftimeand areplace-based relationship label builder.Auto-path crash on schema drift. Added a defensive fallback so
--prefer autowarns and falls back to the HTTP path on anyEdgarqErrorfrom_run_sql_path(Binder, Catalog, etc.).--prefer localstill exits 2 with the bulk-extract hint.The pre-existing
test_insider_hybrid.pyfixture used fabricated column names (ISSUERCIKonNONDERIV_TRANS,ISOFFICERflags onREPORTINGOWNER, etc.) which masked this bug. Fixture updated to match real SEC schema; newtest_insider_real_schema.pyadds regression coverage.Test plan
tests/commands_impl/test_insider_real_schema.py— 3 new tests for schema/fallback/error-surfaceuv run toxmatrix py3.10–3.14 — green (one unrelated flaky parallel test,test_companyfacts_shard_distribution_hash_mod_64, passes in isolation)uv run edgarq insider AAPL --form 4 --limit 3 --no-cache --since 2024-01-01returns real transaction rows;--prefer autowithout bulk extract falls back to HTTP cleanly