Skip to content

feat: add NodeId, datetime, DataFrame type support#2591

Draft
andeplane wants to merge 1 commit into
001-pr1-python-schema-primitivesfrom
001-pr2-python-schema-extended-types
Draft

feat: add NodeId, datetime, DataFrame type support#2591
andeplane wants to merge 1 commit into
001-pr1-python-schema-primitivesfrom
001-pr2-python-schema-extended-types

Conversation

@andeplane
Copy link
Copy Markdown
Contributor

Summary

  • Extends _scalar_to_schema with NodeId, datetime/datetime.datetime, pd.DataFrame/DataFrame
  • Supports all list[T] variants for new types (list[NodeId], list[datetime])
  • list[pd.DataFrame] returns a clear ErrorResult
  • Unrecognized types return error messages naming the offending type

Changes

  • cognite/client/_api/ai/python_schema.py — extended _scalar_to_schema
  • tests/tests_unit/test_api/test_python_schema.py — 20 new tests (@pytest.mark.us2)

Test plan

  • pytest tests/tests_unit/test_api/test_python_schema.py -k "us1 or us2" — all green
  • PR 1 tests still pass

Stack

  • PR 1/3 — primitive types + validation ← base
  • PR 2/3 (this PR) — NodeId, datetime, DataFrame, list types
  • PR 3/3 — docstring enrichment, default values, re-exports

🤖 Generated with Claude Code

Extends _scalar_to_schema with:
- NodeId → JSON Schema object with space/externalId properties
- datetime / datetime.datetime → string + format: date-time
- pd.DataFrame / DataFrame → string + format: cognite-query-id
- list[T] variants for all new types (list[pd.DataFrame] is an error)
- Clear error messages for unrecognized types

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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