Skip to content

Conversation

@ndrluis
Copy link
Collaborator

@ndrluis ndrluis commented Mar 18, 2024

Use case

import pyarrow as pa
import pandas as pd

table = catalog.load_table('some_schema.table_name')
schema = table.schema().as_arrow()

data = {
    'id_job': [1, 2, 3, 4],
    'description': ['some text', 'some text', 'some text', 'some text']
}

df = pd.DataFrame(data)

pa_df = pa.Table.from_pandas(df, schema=schema)

table.append(pa_df)

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for raising this! This makes sense to me. Could you add this to the docs as well?

@ndrluis ndrluis requested a review from Fokko March 18, 2024 20:59
@kevinjqliu
Copy link
Contributor

(reposting from slack)
This is great. Exposing the Iceberg Table's schema as pyarrow schema will also solve the problem I was having here

#520 (comment)

@Fokko Fokko merged commit d3db840 into apache:main Mar 19, 2024
@Fokko
Copy link
Contributor

Fokko commented Mar 19, 2024

Thanks @ndrluis for adding this, and @kevinjqliu for joining the conversation 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants