Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Data is submitted and transmitted via the HTTP protocol. This is demonstrated here using the curl command to show how to submit data for import.

Users can also operate using other HTTP clients.

Code Block
curl --location-trusted -u root -T date -H "label:123" http://abc.com:8030/api/test/date/_load

...

  • Verification of user import permissions.
  • Creation of a Paimon table according to the table creation information.
  • Reading of the uploaded file, data segmentation according to specified separators, followed by batch data import.
  • Execution of filtering and adjustment of column positions.

Signature parameters

Code Block
curl --location-trusted -u user:passwd [-H ""...] -T data.file -XPUT http://load_host:http_port/api/{db}/{table}/_load

...

It's possible to add a SQL parameter in the Header, which can replace the previous parameters such as column_separator, line_delimiter, where, columns, etc., for convenience of use.

Code Block
curl --location-trusted -u user:passwd [-H "sql: ${load_sql}"...] -T data.file -XPUT http://load_host:http_port/api/_http_load


# -- load_sql
# insert into db.table (col, ...) select stream_col, ... from http_load("property1"="value1");


# http parameters
# (
#     "column_separator" = ",",
#     "format" = "CSV",
#     ...
# )

...

In the context of implementing different data format writingwrite operations for multiple data formats, the WriteStrategy interface provides a blueprint `WriteStrategy` interface defines standards for writing operation operations and schema retrieval. Implementing Specific implementation classes would provide the specific dedicated logic for handling different data formats. For example, a CsvWriteStrategy class might implement WriteStrategy to handle CSV files, parsing the content string based on the provided columnSeparator and writing it out in the CSV format. Similarly, JsonWriteStrategy and ExcelWriteStrategy could be implemented for JSON and Excel formats, respectively. Each of these would handle the peculiarities of their respective formats, such as handling JSON objects or Excel cells and rowsthe `CsvWriteStrategy` class implements `WriteStrategy`, specifically handling CSV files by parsing and writing data using the provided column separator.

Code Block
public interface WriteStrategy extends Serializable {

    void writer(BatchTableWrite batchTableWrite, String content, String columnSeparator)
            throws Exception;

    Schema retrieveSchema() throws Exception;
}

...