Conversation
…talog constants A row from process_writes and a row from query() are the same flat dict, and neither says which keys are tags or what type each field column has. Every plugin that rebuilds a line from a row read information_schema itself, with seven copies of the tag data type string, two of the Arrow-to-line-type map and seven of the value-type fallback. get_line_schema returns the tag names and a field-to-line-type map from the get_schema cache; split_row places every key of a row by that schema into the (tags, typed_fields, time_ns) that build_line_typed takes, typing an unknown key from its value. infer_type and the tag_data_type, numeric_types, line_types and numeric_line_types constants become public; the last is the set a numeric column's line type falls in, which four plugins would otherwise derive in a line of their own. Bumps the package to 0.5.0. The design note in docs/row-schema-helpers.md records what was deliberately not supported and which plugin asked for it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Rows from
process_writesand fromquery()do not say which columns are tags or what type each field is. Plugins currently readinformation_schemathemselves to find out, each in a slightly different way. This adds that lookup to utils, plus a helper that turns a row into a typed line. Bumps the package to 0.5.0.New APIs
introspection.get_line_schema(influxdb3_local, table)returns{"tags": [...], "fields": {name: line_type}}. Cached likeget_schema; passrefresh=Trueto re-read the catalog.write.split_row(row, schema)returns(tags, typed_fields, time_ns)ready forbuild_line_typed. Keys the schema does not know are typed from their value.write.infer_type(value)is now public.introspection.tag_data_type,numeric_types,line_types,numeric_line_typesare now public.Usage
Before
After
If a batch can carry a column added after the schema was cached, check for unknown keys and call
get_line_schema(..., refresh=True)before splitting. The README shows this.Plugins that will use this
Adoption follows in a separate PR once 0.5.0 is tagged.
Use
get_line_schemaandsplit_row:Use the schema lookup or the public typing helpers:
Drop a local copy of
add_field_with_typeor a redundant tag re-read:🤖 Generated with Claude Code