Improve /api/<table> schema display and surface table-description knowls (#4811, #4812)#22
Open
roed-math wants to merge 2 commits into
Open
Improve /api/<table> schema display and surface table-description knowls (#4811, #4812)#22roed-math wants to merge 2 commits into
roed-math wants to merge 2 commits into
Conversation
…wls (LMFDB#4811, LMFDB#4812) LMFDB#4812: give the schema table an Example column populated from a random row (db.<table>.random(projection=2)), with values truncated at 100 chars, string reprs quoted, and "[binary data]" for bytea columns. The holder div regains a shared `schema-holder` class and style.css caps it with `max-height: 500px; overflow-y: auto` (via max-height so small tables no longer get an oversized fixed-height scroll box) instead of the dead `height: 300px` block, which no longer matched after the div class was renamed. The duplicate `id="schema-table"` becomes a class. LMFDB#4811: stop appending the table description to the page title and instead surface the `tables.<name>` knowl via KNOWL_INC in collection.html (read-only content for everyone, edit link for logged-in knowl editors). Verified: sage -python -m pytest lmfdb/api/test_api.py (8 passed, incl. two new tests); pyflakes clean on api.py and test_api.py; test-client render of nf_fields, ec_curvedata, mf_hecke_traces, lat_lattices, gps_groups and char_dirichlet shows a populated Example column, the description knowl above the schema, and a title without the parenthetical; datapages still render with no Example column; /style.css serves 200. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…DB#4812) The /api/<table> schema Example column was sampled with coll.random(projection=2). Switch to projection=3, the same full mask (id + all search + all extra columns) the datapage query already uses, so the Example column is sampled consistently and every row shown in the schema table can be populated. Strengthen test_api_schema_display: instead of only asserting that schema-example cells exist, assert that the Example cell for the never-null search column nf_fields.degree carries an actual value, so a future change that blanks search-column examples is caught. Verified: sage -python -m pytest lmfdb/api/test_api.py -> 8 passed; pyflakes clean; test-client renders of /api/nf_fields, /api/ec_curvedata and /api/maass_newforms show nonblank Example cells for search columns (degree, conductor, conrey_index) and the extra column (maass_newforms.coefficients). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
Addressed the external review's P2 finding (Example column projection): commit eae9585 changes the sample to Honest note on the diagnosis: against the pinned psycodict (roed314/psycodict 0.1.13), |
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.
The per-table API pages (
/api/<table>) get two related improvements. For LMFDB#4812, the schema table gains an Example column populated from a random row (db.<table>.random(projection=2)), with values quoted/truncated at 100 chars and[binary data]shown for bytea columns; the schema holder regains a sharedschema-holderclass and is now capped withmax-height: 500px; overflow-y: autoinstyle.cssinstead of the deadheight: 300pxblock left behind by an earlier div-class rename — so small tables no longer render an oversized fixed-height scroll box while large tables still scroll. For LMFDB#4811, thetables.<name>description knowl is surfaced viaKNOWL_INCabove the schema (read-only for everyone, with an edit link for logged-in knowl editors) instead of being appended to the page title in parentheses. Datapages share the same schema template but pass no example data, so they are unchanged apart from the holder styling; two new tests intest_api.pycover both the API-page Example column and the datapage's absence of it. Note this branch will conflict lightly at merge time with the other open API PRs (ranges/null and raw-format) since they also editapi.py/collection.html/test_api.pyin nearby-but-distinct regions. Addresses LMFDB#4811 and LMFDB#4812.🤖 Generated with Claude Code