Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to retrieve custom metadata from tables in rust #2153

Closed
universalmind303 opened this issue Jan 31, 2024 · 3 comments
Closed

Unable to retrieve custom metadata from tables in rust #2153

universalmind303 opened this issue Jan 31, 2024 · 3 comments
Assignees
Labels
binding/rust Issues for the Rust crate enhancement New feature or request help wanted Extra attention is needed

Comments

@universalmind303
Copy link
Contributor

Environment

Delta-rs version:

Binding:

Environment:

  • Cloud provider:
  • OS:
  • Other:

Bug

What happened:
AFAIK, there is no programmatic access to custom metadata written.

use std::sync::Arc;
use deltalake::{
    kernel::DataType as DeltaDataType,
    kernel::PrimitiveType,
    logstore::default_logstore, operations::create::CreateBuilder, protocol::SaveMode, storage::object_store::local::LocalFileSystem
};

use serde_json::json;
use url::Url;
#[tokio::main]
async fn main() {
    let path = tempfile::tempdir().unwrap();
    let path = path.into_path();
    
    let file_store = LocalFileSystem::new_with_prefix(path.clone()).unwrap();
    let log_store = default_logstore(
        Arc::new(file_store),
        &Url::from_file_path(path.clone()).unwrap(),
        &Default::default(),
    );

    let tbl = CreateBuilder::new()
        .with_log_store(log_store.clone())
        .with_save_mode(SaveMode::Overwrite)
        .with_metadata(vec![("my_custom_metadata".to_string(), json!({"key": "value"}))])
        .with_table_name("test")
        .with_column(
            "id",
            DeltaDataType::Primitive(PrimitiveType::Integer),
            true,
            None,
        );
    let tbl = tbl.await.unwrap();
    // how to get the metadata out of `tbl`?
}

How to get the metadata out of tbl?
DeltaTable.config does not have the app_metadata
DeltaTable.state.unwrap() does not have the app_metadata
DeltaTable::metadata() does not have the app_metadata

What you expected to happen:
Some way to retrieve the metadata
How to reproduce it:
See above
More details:
I can manually inspect the json file & it is getting written, but I have no way to retrieve it after it's been written.

@universalmind303 universalmind303 added the bug Something isn't working label Jan 31, 2024
@rtyler rtyler added enhancement New feature or request help wanted Extra attention is needed binding/rust Issues for the Rust crate and removed bug Something isn't working labels Feb 1, 2024
@abhiaagarwal
Copy link
Contributor

take

@abhiaagarwal
Copy link
Contributor

After a bit of research, I think what you're looking for is DeltaTable::history()? It returns a Vec<CommitInfo>, which has the underlying metadata associated.

@ion-elgreco
Copy link
Collaborator

As @abhiaagarwal mentioned you need to fetch the commitInfo from history, also app metadata afaik is not preserved after checkpointing

@ion-elgreco ion-elgreco closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/rust Issues for the Rust crate enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants