diff --git a/paimon-python/pypaimon/common/options/core_options.py b/paimon-python/pypaimon/common/options/core_options.py index 7d9a227e4a9d..384e24138969 100644 --- a/paimon-python/pypaimon/common/options/core_options.py +++ b/paimon-python/pypaimon/common/options/core_options.py @@ -56,6 +56,22 @@ class MergeEngine(str, Enum): FIRST_ROW = "first-row" +class StartupMode(str, Enum): + """ + Startup mode for scan operations. + """ + DEFAULT = "default" + LATEST_FULL = "latest-full" + LATEST = "latest" + COMPACTED_FULL = "compacted-full" + FROM_TIMESTAMP = "from-timestamp" + FROM_SNAPSHOT = "from-snapshot" + FROM_SNAPSHOT_FULL = "from-snapshot-full" + FROM_CREATION_TIMESTAMP = "from-creation-timestamp" + FROM_FILE_CREATION_TIME = "from-file-creation-time" + INCREMENTAL = "incremental" + + class CoreOptions: """Core options for Paimon tables.""" # File format constants @@ -240,6 +256,21 @@ class CoreOptions: .with_description("Specify the file name prefix of data files.") ) # Scan options + SCAN_MODE: ConfigOption[StartupMode] = ( + ConfigOptions.key("scan.mode") + .enum_type(StartupMode) + .default_value(StartupMode.DEFAULT) + .with_description( + "Scan startup mode for the table. " + "'default' resolves the actual mode from other scan options. " + "'latest-full' reads the latest snapshot then streams changes. " + "'latest' only streams changes without an initial snapshot. " + "'from-timestamp' reads from a specific timestamp. " + "'from-snapshot' reads from a specific snapshot. " + "'incremental' reads incremental changes between two snapshots/tags." + ) + ) + SCAN_FALLBACK_BRANCH: ConfigOption[str] = ( ConfigOptions.key("scan.fallback-branch") .string_type() @@ -613,6 +644,9 @@ def blob_target_file_size(self, default=None): def data_file_prefix(self, default=None): return self.options.get(CoreOptions.DATA_FILE_PREFIX, default) + def scan_mode(self, default=None): + return self.options.get(CoreOptions.SCAN_MODE, default) + def scan_fallback_branch(self, default=None): return self.options.get(CoreOptions.SCAN_FALLBACK_BRANCH, default)