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

Added without_files flag to DeltaTable constructor #866

Merged
merged 5 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion python/deltalake/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def __init__(
table_uri: str,
version: Optional[int] = None,
storage_options: Optional[Dict[str, str]] = None,
without_files: bool = False,
):
"""
Create the Delta Table from a path with an optional version.
Expand All @@ -86,10 +87,16 @@ def __init__(
:param table_uri: the path of the DeltaTable
:param version: version of the DeltaTable
:param storage_options: a dictionary of the options to use for the storage backend
:param without_files: If True, will load table without tracking files.
Some append-only applications might have no need of tracking any files. So, the
DeltaTable will be loaded with a significant memory reduction.
"""
MykhailoHevak marked this conversation as resolved.
Show resolved Hide resolved
self._storage_options = storage_options
self._table = RawDeltaTable(
table_uri, version=version, storage_options=storage_options
table_uri,
version=version,
storage_options=storage_options,
without_files=without_files,
)
self._metadata = Metadata(self._table)

Expand Down
6 changes: 6 additions & 0 deletions python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ impl RawDeltaTable {
table_uri: &str,
version: Option<deltalake::DeltaDataTypeLong>,
storage_options: Option<HashMap<String, String>>,
without_files: bool,
) -> PyResult<Self> {
let mut builder = deltalake::DeltaTableBuilder::from_uri(table_uri);
if let Some(storage_options) = storage_options {
Expand All @@ -114,6 +115,11 @@ impl RawDeltaTable {
if let Some(version) = version {
builder = builder.with_version(version)
}

if without_files {
builder = builder.without_files()
}

let table = rt()?
.block_on(builder.load())
.map_err(PyDeltaTableError::from_raw)?;
Expand Down