# R2 Data Catalog ## List R2 catalogs `r2_data_catalog.list(R2DataCatalogListParams**kwargs) -> R2DataCatalogListResponse` **get** `/accounts/{account_id}/r2-catalog` Returns a list of R2 buckets that have been enabled as Apache Iceberg catalogs for the specified account. Each catalog represents an R2 bucket configured to store Iceberg metadata and data files. ### Parameters - `account_id: str` Use this to identify the account. ### Returns - `class R2DataCatalogListResponse: …` Contains the list of catalogs. - `warehouses: List[Warehouse]` Lists catalogs in the account. - `id: str` Use this to uniquely identify the catalog. - `bucket: str` Specifies the associated R2 bucket name. - `name: str` Specifies the catalog name (generated from account and bucket name). - `status: Literal["active", "inactive"]` Indicates the status of the catalog. - `"active"` - `"inactive"` - `credential_status: Optional[Literal["present", "absent"]]` Shows the credential configuration status. - `"present"` - `"absent"` - `maintenance_config: Optional[WarehouseMaintenanceConfig]` Configures maintenance for the catalog. - `compaction: Optional[WarehouseMaintenanceConfigCompaction]` Configures compaction for catalog maintenance. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[WarehouseMaintenanceConfigSnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) r2_data_catalogs = client.r2_data_catalog.list( account_id="0123456789abcdef0123456789abcdef", ) print(r2_data_catalogs.warehouses) ``` #### Response ```json { "errors": [], "messages": [], "result": { "warehouses": [ { "bucket": "analytics-bucket", "id": "550e8400-e29b-41d4-a716-446655440000", "maintenance_config": { "compaction": { "state": "enabled", "target_size_mb": "128" }, "snapshot_expiration": { "max_snapshot_age": "7d", "min_snapshots_to_keep": 100, "state": "enabled" } }, "name": "account123_analytics-bucket", "status": "active" }, { "bucket": "logs-bucket", "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "maintenance_config": { "compaction": { "state": "disabled", "target_size_mb": "128" }, "snapshot_expiration": { "max_snapshot_age": "7d", "min_snapshots_to_keep": 100, "state": "disabled" } }, "name": "account123_logs-bucket", "status": "inactive" } ] }, "success": true } ``` ## Get R2 catalog details `r2_data_catalog.get(strbucket_name, R2DataCatalogGetParams**kwargs) -> R2DataCatalogGetResponse` **get** `/accounts/{account_id}/r2-catalog/{bucket_name}` Retrieve detailed information about a specific R2 catalog by bucket name. Returns catalog status, maintenance configuration, and credential status. ### Parameters - `account_id: str` Use this to identify the account. - `bucket_name: str` Specifies the R2 bucket name. ### Returns - `class R2DataCatalogGetResponse: …` Contains R2 Data Catalog information. - `id: str` Use this to uniquely identify the catalog. - `bucket: str` Specifies the associated R2 bucket name. - `name: str` Specifies the catalog name (generated from account and bucket name). - `status: Literal["active", "inactive"]` Indicates the status of the catalog. - `"active"` - `"inactive"` - `credential_status: Optional[Literal["present", "absent"]]` Shows the credential configuration status. - `"present"` - `"absent"` - `maintenance_config: Optional[MaintenanceConfig]` Configures maintenance for the catalog. - `compaction: Optional[MaintenanceConfigCompaction]` Configures compaction for catalog maintenance. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[MaintenanceConfigSnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) r2_data_catalog = client.r2_data_catalog.get( bucket_name="my-data-bucket", account_id="0123456789abcdef0123456789abcdef", ) print(r2_data_catalog.id) ``` #### Response ```json { "errors": [], "messages": [], "result": { "bucket": "analytics-bucket", "credential_status": "present", "id": "550e8400-e29b-41d4-a716-446655440000", "maintenance_config": { "compaction": { "state": "enabled", "target_size_mb": "128" }, "snapshot_expiration": { "max_snapshot_age": "7d", "min_snapshots_to_keep": 100, "state": "enabled" } }, "name": "account123_analytics-bucket", "status": "active" }, "success": true } ``` ## Enable R2 bucket as a catalog `r2_data_catalog.enable(strbucket_name, R2DataCatalogEnableParams**kwargs) -> R2DataCatalogEnableResponse` **post** `/accounts/{account_id}/r2-catalog/{bucket_name}/enable` Enable an R2 bucket as an Apache Iceberg catalog. This operation creates the necessary catalog infrastructure and activates the bucket for storing Iceberg metadata and data files. ### Parameters - `account_id: str` Use this to identify the account. - `bucket_name: str` Specifies the R2 bucket name. ### Returns - `class R2DataCatalogEnableResponse: …` Contains response from activating an R2 bucket as a catalog. - `id: str` Use this to uniquely identify the activated catalog. - `name: str` Specifies the name of the activated catalog. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.r2_data_catalog.enable( bucket_name="my-data-bucket", account_id="0123456789abcdef0123456789abcdef", ) print(response.id) ``` #### Response ```json { "errors": [], "messages": [], "result": { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "account123_my-bucket" }, "success": true } ``` ## Disable R2 catalog `r2_data_catalog.disable(strbucket_name, R2DataCatalogDisableParams**kwargs)` **post** `/accounts/{account_id}/r2-catalog/{bucket_name}/disable` Disable an R2 bucket as a catalog. This operation deactivates the catalog but preserves existing metadata and data files. The catalog can be re-enabled later. ### Parameters - `account_id: str` Use this to identify the account. - `bucket_name: str` Specifies the R2 bucket name. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) client.r2_data_catalog.disable( bucket_name="my-data-bucket", account_id="0123456789abcdef0123456789abcdef", ) ``` ## Domain Types ### R2 Data Catalog List Response - `class R2DataCatalogListResponse: …` Contains the list of catalogs. - `warehouses: List[Warehouse]` Lists catalogs in the account. - `id: str` Use this to uniquely identify the catalog. - `bucket: str` Specifies the associated R2 bucket name. - `name: str` Specifies the catalog name (generated from account and bucket name). - `status: Literal["active", "inactive"]` Indicates the status of the catalog. - `"active"` - `"inactive"` - `credential_status: Optional[Literal["present", "absent"]]` Shows the credential configuration status. - `"present"` - `"absent"` - `maintenance_config: Optional[WarehouseMaintenanceConfig]` Configures maintenance for the catalog. - `compaction: Optional[WarehouseMaintenanceConfigCompaction]` Configures compaction for catalog maintenance. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[WarehouseMaintenanceConfigSnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` ### R2 Data Catalog Get Response - `class R2DataCatalogGetResponse: …` Contains R2 Data Catalog information. - `id: str` Use this to uniquely identify the catalog. - `bucket: str` Specifies the associated R2 bucket name. - `name: str` Specifies the catalog name (generated from account and bucket name). - `status: Literal["active", "inactive"]` Indicates the status of the catalog. - `"active"` - `"inactive"` - `credential_status: Optional[Literal["present", "absent"]]` Shows the credential configuration status. - `"present"` - `"absent"` - `maintenance_config: Optional[MaintenanceConfig]` Configures maintenance for the catalog. - `compaction: Optional[MaintenanceConfigCompaction]` Configures compaction for catalog maintenance. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[MaintenanceConfigSnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` ### R2 Data Catalog Enable Response - `class R2DataCatalogEnableResponse: …` Contains response from activating an R2 bucket as a catalog. - `id: str` Use this to uniquely identify the activated catalog. - `name: str` Specifies the name of the activated catalog. # Maintenance Configs ## Get catalog maintenance configuration `r2_data_catalog.maintenance_configs.get(strbucket_name, MaintenanceConfigGetParams**kwargs) -> MaintenanceConfigGetResponse` **get** `/accounts/{account_id}/r2-catalog/{bucket_name}/maintenance-configs` Retrieve the maintenance configuration for a specific catalog, including compaction settings and credential status. ### Parameters - `account_id: str` Use this to identify the account. - `bucket_name: str` Specifies the R2 bucket name. ### Returns - `class MaintenanceConfigGetResponse: …` Contains maintenance configuration and credential status. - `credential_status: Literal["present", "absent"]` Shows the credential configuration status. - `"present"` - `"absent"` - `maintenance_config: MaintenanceConfig` Configures maintenance for the catalog. - `compaction: Optional[MaintenanceConfigCompaction]` Configures compaction for catalog maintenance. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[MaintenanceConfigSnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) maintenance_config = client.r2_data_catalog.maintenance_configs.get( bucket_name="my-data-bucket", account_id="0123456789abcdef0123456789abcdef", ) print(maintenance_config.credential_status) ``` #### Response ```json { "errors": [], "messages": [], "result": { "credential_status": "present", "maintenance_config": { "compaction": { "state": "enabled", "target_size_mb": "128" }, "snapshot_expiration": { "max_snapshot_age": "7d", "min_snapshots_to_keep": 100, "state": "enabled" } } }, "success": true } ``` ## Update catalog maintenance configuration `r2_data_catalog.maintenance_configs.update(strbucket_name, MaintenanceConfigUpdateParams**kwargs) -> MaintenanceConfigUpdateResponse` **post** `/accounts/{account_id}/r2-catalog/{bucket_name}/maintenance-configs` Update the maintenance configuration for a catalog. This allows you to enable or disable compaction and adjust target file sizes for optimization. ### Parameters - `account_id: str` Use this to identify the account. - `bucket_name: str` Specifies the R2 bucket name. - `compaction: Optional[Compaction]` Updates compaction configuration (all fields optional). - `state: Optional[Literal["enabled", "disabled"]]` Updates the state optionally. - `"enabled"` - `"disabled"` - `target_size_mb: Optional[Literal["64", "128", "256", "512"]]` Updates the target file size optionally. - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[SnapshotExpiration]` Updates snapshot expiration configuration (all fields optional). - `max_snapshot_age: Optional[str]` Updates the maximum age for snapshots optionally. - `min_snapshots_to_keep: Optional[int]` Updates the minimum number of snapshots to retain optionally. - `state: Optional[Literal["enabled", "disabled"]]` Updates the state optionally. - `"enabled"` - `"disabled"` ### Returns - `class MaintenanceConfigUpdateResponse: …` Configures maintenance for the catalog. - `compaction: Optional[Compaction]` Configures compaction for catalog maintenance. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[SnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) maintenance_config = client.r2_data_catalog.maintenance_configs.update( bucket_name="my-data-bucket", account_id="0123456789abcdef0123456789abcdef", compaction={ "state": "enabled", "target_size_mb": "256", }, snapshot_expiration={ "max_snapshot_age": "14d", "min_snapshots_to_keep": 5, "state": "enabled", }, ) print(maintenance_config.compaction) ``` #### Response ```json { "errors": [], "messages": [], "result": { "compaction": { "state": "enabled", "target_size_mb": "256" }, "snapshot_expiration": { "max_snapshot_age": "14d", "min_snapshots_to_keep": 5, "state": "enabled" } }, "success": true } ``` ## Domain Types ### Maintenance Config Get Response - `class MaintenanceConfigGetResponse: …` Contains maintenance configuration and credential status. - `credential_status: Literal["present", "absent"]` Shows the credential configuration status. - `"present"` - `"absent"` - `maintenance_config: MaintenanceConfig` Configures maintenance for the catalog. - `compaction: Optional[MaintenanceConfigCompaction]` Configures compaction for catalog maintenance. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[MaintenanceConfigSnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` ### Maintenance Config Update Response - `class MaintenanceConfigUpdateResponse: …` Configures maintenance for the catalog. - `compaction: Optional[Compaction]` Configures compaction for catalog maintenance. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[SnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` # Credentials ## Store catalog credentials `r2_data_catalog.credentials.create(strbucket_name, CredentialCreateParams**kwargs) -> object` **post** `/accounts/{account_id}/r2-catalog/{bucket_name}/credential` Store authentication credentials for a catalog. These credentials are used to authenticate with R2 storage when performing catalog operations. ### Parameters - `account_id: str` Use this to identify the account. - `bucket_name: str` Specifies the R2 bucket name. - `token: str` Provides the Cloudflare API token for accessing R2. ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) credential = client.r2_data_catalog.credentials.create( bucket_name="my-data-bucket", account_id="0123456789abcdef0123456789abcdef", token="your-cloudflare-api-token-here", ) print(credential) ``` #### Response ```json { "errors": [], "messages": [], "result": null, "success": true } ``` # Namespaces ## List namespaces in catalog `r2_data_catalog.namespaces.list(strbucket_name, NamespaceListParams**kwargs) -> NamespaceListResponse` **get** `/accounts/{account_id}/r2-catalog/{bucket_name}/namespaces` Returns a list of namespaces in the specified R2 catalog. Supports hierarchical filtering and pagination for efficient traversal of large namespace hierarchies. ### Parameters - `account_id: str` Use this to identify the account. - `bucket_name: str` Specifies the R2 bucket name. - `page_size: Optional[int]` Maximum number of namespaces to return per page. Defaults to 100, maximum 1000. - `page_token: Optional[str]` Opaque pagination token from a previous response. Use this to fetch the next page of results. - `parent: Optional[str]` Parent namespace to filter by. Only returns direct children of this namespace. For nested namespaces, use %1F as separator (e.g., "bronze%1Fanalytics"). Omit this parameter to list top-level namespaces. - `return_details: Optional[bool]` Whether to include additional metadata (timestamps). When true, response includes created_at and updated_at arrays. - `return_uuids: Optional[bool]` Whether to include namespace UUIDs in the response. Set to true to receive the namespace_uuids array. ### Returns - `class NamespaceListResponse: …` Contains the list of namespaces with optional pagination. - `namespaces: List[List[str]]` Lists namespaces in the catalog. - `details: Optional[List[Detail]]` Contains detailed metadata for each namespace when return_details is true. Each object includes the namespace, UUID, and timestamps. - `namespace: List[str]` Specifies the hierarchical namespace parts as an array of strings. For example, ["bronze", "analytics"] represents the namespace "bronze.analytics". - `namespace_uuid: str` Contains the UUID that persists across renames. - `created_at: Optional[datetime]` Indicates the creation timestamp in ISO 8601 format. - `updated_at: Optional[datetime]` Shows the last update timestamp in ISO 8601 format. Null if never updated. - `namespace_uuids: Optional[List[str]]` Contains UUIDs for each namespace when return_uuids is true. The order corresponds to the namespaces array. - `next_page_token: Optional[str]` Use this opaque token to fetch the next page of results. A null or absent value indicates the last page. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) namespaces = client.r2_data_catalog.namespaces.list( bucket_name="my-data-bucket", account_id="0123456789abcdef0123456789abcdef", ) print(namespaces.namespace_uuids) ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "success": true, "result": { "namespaces": [ [ "bronze", "analytics" ] ], "details": [ { "namespace": [ "bronze", "analytics" ], "namespace_uuid": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "updated_at": "2019-12-27T18:11:19.117Z" } ], "namespace_uuids": [ "0199b999-6869-7383-bb1f-d30e059d5326", "0199b99b-2c88-73b3-8dbb-421e0e8f2757" ], "next_page_token": "MSYxNzU5NzU1NTc4NTA0MTk0JjAxOTliOTliLTJjODgtNzNiMy04ZGJiLTQyMWUwZThmMjc1Nw" } } ``` ## Domain Types ### Namespace List Response - `class NamespaceListResponse: …` Contains the list of namespaces with optional pagination. - `namespaces: List[List[str]]` Lists namespaces in the catalog. - `details: Optional[List[Detail]]` Contains detailed metadata for each namespace when return_details is true. Each object includes the namespace, UUID, and timestamps. - `namespace: List[str]` Specifies the hierarchical namespace parts as an array of strings. For example, ["bronze", "analytics"] represents the namespace "bronze.analytics". - `namespace_uuid: str` Contains the UUID that persists across renames. - `created_at: Optional[datetime]` Indicates the creation timestamp in ISO 8601 format. - `updated_at: Optional[datetime]` Shows the last update timestamp in ISO 8601 format. Null if never updated. - `namespace_uuids: Optional[List[str]]` Contains UUIDs for each namespace when return_uuids is true. The order corresponds to the namespaces array. - `next_page_token: Optional[str]` Use this opaque token to fetch the next page of results. A null or absent value indicates the last page. # Tables ## List tables in namespace `r2_data_catalog.namespaces.tables.list(strnamespace, TableListParams**kwargs) -> TableListResponse` **get** `/accounts/{account_id}/r2-catalog/{bucket_name}/namespaces/{namespace}/tables` Returns a list of tables in the specified namespace within an R2 catalog. Supports pagination for efficient traversal of large table collections. ### Parameters - `account_id: str` Use this to identify the account. - `bucket_name: str` Specifies the R2 bucket name. - `namespace: str` - `page_size: Optional[int]` Maximum number of tables to return per page. Defaults to 100, maximum 1000. - `page_token: Optional[str]` Opaque pagination token from a previous response. Use this to fetch the next page of results. - `return_details: Optional[bool]` Whether to include additional metadata (timestamps, locations). When true, response includes created_at, updated_at, metadata_locations, and locations arrays. - `return_uuids: Optional[bool]` Whether to include table UUIDs in the response. Set to true to receive the table_uuids array. ### Returns - `class TableListResponse: …` Contains the list of tables with optional pagination. - `identifiers: List[Identifier]` Lists tables in the namespace. - `name: str` Specifies the table name. - `namespace: List[str]` Specifies the hierarchical namespace parts as an array of strings. For example, ["bronze", "analytics"] represents the namespace "bronze.analytics". - `details: Optional[List[Detail]]` Contains detailed metadata for each table when return_details is true. Each object includes identifier, UUID, timestamps, and locations. - `identifier: DetailIdentifier` Specifies a unique table identifier within a catalog. - `name: str` Specifies the table name. - `namespace: List[str]` Specifies the hierarchical namespace parts as an array of strings. For example, ["bronze", "analytics"] represents the namespace "bronze.analytics". - `table_uuid: str` Contains the UUID that persists across renames. - `created_at: Optional[datetime]` Indicates the creation timestamp in ISO 8601 format. - `location: Optional[str]` Specifies the base S3 URI for table storage location. - `metadata_location: Optional[str]` Contains the S3 URI to table metadata file. Null for staged tables. - `updated_at: Optional[datetime]` Shows the last update timestamp in ISO 8601 format. Null if never updated. - `next_page_token: Optional[str]` Use this opaque token to fetch the next page of results. A null or absent value indicates the last page. - `table_uuids: Optional[List[str]]` Contains UUIDs for each table when return_uuids is true. The order corresponds to the identifiers array. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) tables = client.r2_data_catalog.namespaces.tables.list( namespace="bronze", account_id="0123456789abcdef0123456789abcdef", bucket_name="my-data-bucket", ) print(tables.identifiers) ``` #### Response ```json { "errors": [], "messages": [], "result": { "details": [ { "created_at": "2025-10-07T10:00:00Z", "identifier": { "name": "events", "namespace": [ "bronze" ] }, "location": "s3://my-bucket/__r2_data_catalog/wh-id/table-id/", "metadata_location": "s3://my-bucket/__r2_data_catalog/wh-id/table-id/metadata/v1.metadata.json", "table_uuid": "0199b9a1-28a0-71e0-a73e-b0fc32c8468e", "updated_at": "2025-10-07T15:00:00Z" }, { "created_at": "2025-10-07T10:30:00Z", "identifier": { "name": "users", "namespace": [ "bronze" ] }, "location": "s3://my-bucket/__r2_data_catalog/wh-id/table-id-2/", "metadata_location": "s3://my-bucket/__r2_data_catalog/wh-id/table-id-2/metadata/v2.metadata.json", "table_uuid": "0199b9a1-3c74-7731-bf53-d8c67ead079d", "updated_at": "2025-10-07T16:00:00Z" } ], "identifiers": [ { "name": "events", "namespace": [ "bronze" ] }, { "name": "users", "namespace": [ "bronze" ] } ], "next_page_token": null, "table_uuids": [ "0199b9a1-28a0-71e0-a73e-b0fc32c8468e", "0199b9a1-3c74-7731-bf53-d8c67ead079d" ] }, "success": true } ``` ## Domain Types ### Table List Response - `class TableListResponse: …` Contains the list of tables with optional pagination. - `identifiers: List[Identifier]` Lists tables in the namespace. - `name: str` Specifies the table name. - `namespace: List[str]` Specifies the hierarchical namespace parts as an array of strings. For example, ["bronze", "analytics"] represents the namespace "bronze.analytics". - `details: Optional[List[Detail]]` Contains detailed metadata for each table when return_details is true. Each object includes identifier, UUID, timestamps, and locations. - `identifier: DetailIdentifier` Specifies a unique table identifier within a catalog. - `name: str` Specifies the table name. - `namespace: List[str]` Specifies the hierarchical namespace parts as an array of strings. For example, ["bronze", "analytics"] represents the namespace "bronze.analytics". - `table_uuid: str` Contains the UUID that persists across renames. - `created_at: Optional[datetime]` Indicates the creation timestamp in ISO 8601 format. - `location: Optional[str]` Specifies the base S3 URI for table storage location. - `metadata_location: Optional[str]` Contains the S3 URI to table metadata file. Null for staged tables. - `updated_at: Optional[datetime]` Shows the last update timestamp in ISO 8601 format. Null if never updated. - `next_page_token: Optional[str]` Use this opaque token to fetch the next page of results. A null or absent value indicates the last page. - `table_uuids: Optional[List[str]]` Contains UUIDs for each table when return_uuids is true. The order corresponds to the identifiers array. # Maintenance Configs ## Get table maintenance configuration `r2_data_catalog.namespaces.tables.maintenance_configs.get(strtable_name, MaintenanceConfigGetParams**kwargs) -> MaintenanceConfigGetResponse` **get** `/accounts/{account_id}/r2-catalog/{bucket_name}/namespaces/{namespace}/tables/{table_name}/maintenance-configs` Retrieve the maintenance configuration for a specific table, including compaction settings. ### Parameters - `account_id: str` Use this to identify the account. - `bucket_name: str` Specifies the R2 bucket name. - `namespace: str` - `table_name: str` ### Returns - `class MaintenanceConfigGetResponse: …` Contains table maintenance configuration. - `maintenance_config: MaintenanceConfig` Configures maintenance for the table. - `compaction: Optional[MaintenanceConfigCompaction]` Configures compaction settings for table optimization. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[MaintenanceConfigSnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) maintenance_config = client.r2_data_catalog.namespaces.tables.maintenance_configs.get( table_name="my_table", account_id="0123456789abcdef0123456789abcdef", bucket_name="my-data-bucket", namespace="my_namespace%1Fsub_namespace", ) print(maintenance_config.maintenance_config) ``` #### Response ```json { "errors": [], "messages": [], "result": { "maintenance_config": { "compaction": { "state": "enabled", "target_size_mb": "128" }, "snapshot_expiration": { "max_snapshot_age": "7d", "min_snapshots_to_keep": 100, "state": "enabled" } } }, "success": true } ``` ## Update table maintenance configuration `r2_data_catalog.namespaces.tables.maintenance_configs.update(strtable_name, MaintenanceConfigUpdateParams**kwargs) -> MaintenanceConfigUpdateResponse` **post** `/accounts/{account_id}/r2-catalog/{bucket_name}/namespaces/{namespace}/tables/{table_name}/maintenance-configs` Update the maintenance configuration for a specific table. This allows you to enable or disable compaction and adjust target file sizes for optimization. ### Parameters - `account_id: str` Use this to identify the account. - `bucket_name: str` Specifies the R2 bucket name. - `namespace: str` - `table_name: str` - `compaction: Optional[Compaction]` Updates compaction configuration (all fields optional). - `state: Optional[Literal["enabled", "disabled"]]` Updates the state optionally. - `"enabled"` - `"disabled"` - `target_size_mb: Optional[Literal["64", "128", "256", "512"]]` Updates the target file size optionally. - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[SnapshotExpiration]` Updates snapshot expiration configuration (all fields optional). - `max_snapshot_age: Optional[str]` Updates the maximum age for snapshots optionally. - `min_snapshots_to_keep: Optional[int]` Updates the minimum number of snapshots to retain optionally. - `state: Optional[Literal["enabled", "disabled"]]` Updates the state optionally. - `"enabled"` - `"disabled"` ### Returns - `class MaintenanceConfigUpdateResponse: …` Configures maintenance for the table. - `compaction: Optional[Compaction]` Configures compaction settings for table optimization. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[SnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) maintenance_config = client.r2_data_catalog.namespaces.tables.maintenance_configs.update( table_name="my_table", account_id="0123456789abcdef0123456789abcdef", bucket_name="my-data-bucket", namespace="my_namespace%1Fsub_namespace", compaction={ "state": "enabled", "target_size_mb": "256", }, snapshot_expiration={ "max_snapshot_age": "14d", "min_snapshots_to_keep": 5, "state": "enabled", }, ) print(maintenance_config.compaction) ``` #### Response ```json { "errors": [], "messages": [], "result": { "compaction": { "state": "enabled", "target_size_mb": "256" }, "snapshot_expiration": { "max_snapshot_age": "14d", "min_snapshots_to_keep": 5, "state": "enabled" } }, "success": true } ``` ## Domain Types ### Maintenance Config Get Response - `class MaintenanceConfigGetResponse: …` Contains table maintenance configuration. - `maintenance_config: MaintenanceConfig` Configures maintenance for the table. - `compaction: Optional[MaintenanceConfigCompaction]` Configures compaction settings for table optimization. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[MaintenanceConfigSnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` ### Maintenance Config Update Response - `class MaintenanceConfigUpdateResponse: …` Configures maintenance for the table. - `compaction: Optional[Compaction]` Configures compaction settings for table optimization. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"` - `target_size_mb: Literal["64", "128", "256", "512"]` Sets the target file size for compaction in megabytes. Defaults to "128". - `"64"` - `"128"` - `"256"` - `"512"` - `snapshot_expiration: Optional[SnapshotExpiration]` Configures snapshot expiration settings. - `max_snapshot_age: str` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `min_snapshots_to_keep: int` Specifies the minimum number of snapshots to retain. Defaults to 100. - `state: Literal["enabled", "disabled"]` Specifies the state of maintenance operations. - `"enabled"` - `"disabled"`