Skip to content

Conversation

@fresh-borzoni
Copy link
Contributor

Purpose

Linked issue: close #137

Adds a Python append() method to enable single-row inserts with support for dict, list, and tuple input formats, providing a more ergonomic API for appending individual rows compared to batch operations.

Brief change log

  • Add append() method to Python Table class with support for dict, list, and tuple input
  • Implement RowInput enum with FromPyObject derive for automatic type dispatch
  • Add python_to_generic_row() function to convert Python values to GenericRow with strict validation
  • Add python_value_to_datum() function with type-specific conversions, optimized bytes extraction, and field-level error messages
  • Add Python patterns to .gitignore to exclude __pycache__/ and *.so files
  • Add usage examples and type stubs for the new API

API and Format

API Changes: Yes

  • New public method: Table.append(row) accepting dict | list | tuple
  • Blocking operation (releases GIL during execution)

Storage Format: No changes

Documentation

New Feature: Yes

  • Added docstring with examples for dict, list, and tuple input
  • Added type stubs in __init__.pyi
  • Added usage examples in example/example.py

@fresh-borzoni
Copy link
Contributor Author

@luoyuxia PTAL, when comfortable 🙏

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a row-based append API to Python bindings, enabling single-row inserts with support for dict, list, and tuple input formats. This provides a more ergonomic alternative to batch operations for streaming use cases and real-time ingestion.

Changes:

  • Added append() method to AppendWriter class supporting dict, list, and tuple input formats
  • Implemented type conversion logic from Python values to Fluss Datum types with strict validation
  • Added Python patterns to .gitignore to exclude build artifacts

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
bindings/python/src/table.rs Adds append() method, row input conversion logic, and Python-to-Datum type mapping with validation
bindings/python/fluss/init.pyi Adds type stubs and comprehensive documentation for the new append() method
bindings/python/example/example.py Demonstrates usage of new append() API with dict and list inputs
.gitignore Adds Python-specific ignore patterns for build artifacts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Add row-level append() API for single-record operations in python bindings

1 participant