@@ -260,20 +260,80 @@ end
260260# High-level functions using the async API pattern from RustyObjectStore.jl
261261
262262"""
263- table_open(snapshot_path::String)::IcebergTable
263+ PropertyEntry
264+
265+ FFI structure for passing key-value properties to Rust.
266+
267+ # Fields
268+ - `key::Ptr{Cchar}`: Pointer to the key string
269+ - `value::Ptr{Cchar}`: Pointer to the value string
270+ """
271+ struct PropertyEntry
272+ key:: Ptr{Cchar}
273+ value:: Ptr{Cchar}
274+ end
275+
276+ """
277+ table_open(snapshot_path::String; scheme::String="s3", properties::Dict{String,String}=Dict{String,String}())::Table
264278
265279Open an Iceberg table from the given snapshot path.
280+
281+ # Arguments
282+ - `snapshot_path::String`: Path to the metadata.json file for the table snapshot
283+ - `scheme::String`: Storage scheme (e.g., "s3", "file"). Defaults to "s3"
284+ - `properties::Dict{String,String}`: Optional key-value properties for the FileIO configuration.
285+ By default (empty dict), credentials are read from environment variables (AWS_ACCESS_KEY_ID,
286+ AWS_SECRET_ACCESS_KEY, AWS_REGION, AWS_ENDPOINT_URL, etc.).
287+
288+ Common S3 properties include:
289+ - "s3.endpoint": Custom S3 endpoint URL
290+ - "s3.access-key-id": AWS access key ID
291+ - "s3.secret-access-key": AWS secret access key
292+ - "s3.session-token": AWS session token
293+ - "s3.region": AWS region
294+ - "s3.allow-anonymous": Set to "true" for anonymous access (no credentials)
295+
296+ # Example
297+ ```julia
298+ # Open with credentials from environment variables (default)
299+ table = table_open("s3://bucket/path/metadata/metadata.json")
300+
301+ # Open with anonymous S3 access
302+ table = table_open(
303+ "s3://bucket/path/metadata/metadata.json",
304+ properties=Dict("s3.allow-anonymous" => "true")
305+ )
306+
307+ # Open with custom S3 credentials
308+ table = table_open(
309+ "s3://bucket/path/metadata/metadata.json",
310+ scheme="s3",
311+ properties=Dict(
312+ "s3.endpoint" => "http://localhost:9000",
313+ "s3.access-key-id" => "minioadmin",
314+ "s3.secret-access-key" => "minioadmin",
315+ "s3.region" => "us-east-1"
316+ )
317+ )
318+ ```
266319"""
267- function table_open (snapshot_path:: String )
320+ function table_open (snapshot_path:: String ; scheme :: String = " s3 " , properties :: Dict{String,String} = Dict {String,String} () )
268321 response = TableResponse ()
269322 ct = current_task ()
270323 event = Base. Event ()
271324 handle = pointer_from_objref (event)
272325
326+ # Convert properties dict to array of PropertyEntry structs
327+ property_entries = [PropertyEntry (pointer (k), pointer (v)) for (k, v) in properties]
328+ properties_len = length (property_entries)
329+
273330 preserve_task (ct)
274- result = GC. @preserve response event try
331+ result = GC. @preserve response event property_entries properties try
275332 result = @ccall rust_lib. iceberg_table_open (
276333 snapshot_path:: Cstring ,
334+ scheme:: Cstring ,
335+ (properties_len > 0 ? pointer (property_entries) : C_NULL ):: Ptr{PropertyEntry} ,
336+ properties_len:: Csize_t ,
277337 response:: Ref{TableResponse} ,
278338 handle:: Ptr{Cvoid}
279339 ):: Cint
0 commit comments