Forward schema_path/target_class to linkml's delimited file loader#235
Open
Sigfried wants to merge 1 commit into
Open
Forward schema_path/target_class to linkml's delimited file loader#235Sigfried wants to merge 1 commit into
Sigfried wants to merge 1 commit into
Conversation
Pass through the new schema-aware loading params so that string-ranged and enum-ranged columns in TSV/CSV files are not coerced to int/float. Requires linkml >=1.11 (PR linkml/linkml#3289 added schema-awareness to the underlying _DelimitedFileLoader; released in v1.11.0). Also imports nothing new from `typing` — the new annotations use PEP 604 `X | Y | None` syntax to match the rest of the file's style. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sigfried
added a commit
to linkml/dm-bip
that referenced
this pull request
May 14, 2026
linkml/linkml#3289 was released in linkml v1.11.0; schema-automator/#188 was released in v0.5.5. Switch both from git URL pins to PyPI version specifiers. linkml-map fix is still unreleased (PR linkml/linkml-map#235 open) — its git pin stays in place until that ships. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
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
Forward
schema_pathandtarget_classthroughTsvFileLoader,CsvFileLoader,DataLoader, andget_file_loader()so they reach linkml's underlyingTsvLoader/CsvLoader. This enables schema-aware type coercion for delimited files, preventing string-ranged and enum-ranged columns from being silently coerced to int/float.Without these parameters, a column like
subject_idcontaining numeric-looking strings (e.g.,"00123") gets loaded as123(int) by pandas' default inference, losing the leading zero and breaking downstream lookups.Background
linkml/linkml#3289 ("Make delimited file loader schema-aware to preserve string/enum columns") added schema-awareness to linkml's
_DelimitedFileLoader. It was released in linkml v1.11.0. This PR exposes those parameters through linkml-map's loader API so users of linkml-map can benefit from the same fix.Changes
TsvFileLoader.__init__/CsvFileLoader.__init__: accept optionalschema_pathandtarget_classiter_instances(): forward both params to the underlying linkml loaderget_file_loader(): kwargs-onlyschema_path/target_class, passed only to TSV/CSV loader classes (other formats already do their own type handling)DataLoader.__init__: accept and store both paramsThe change is additive — existing callers that don't pass the new params get current behavior. Annotations use PEP 604 `X | Y | None` syntax to match the rest of the file's style (no new `typing` imports needed).
Test plan
🤖 Generated with Claude Code