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

Add Dataset close and context manager support to the Python API #767

Merged
merged 3 commits into from
Sep 5, 2024

Conversation

gspowley
Copy link
Member

@gspowley gspowley commented Sep 4, 2024

Add context manager support to the Python Dataset class.

import tiledbvcf

ds_uri = "..."

with tiledbvcf.Dataset(ds_uri) as ds:
    num_records = ds.count()

For code that doesn't use the context manager, a separate close method is available.

import tiledbvcf

ds_uri = "..."

ds = tiledbvcf.Dataset(ds_uri)
num_records = ds.count()
ds.close()

@gspowley gspowley requested review from leipzig and awenocur September 4, 2024 21:01
@gspowley gspowley merged commit ade7a50 into main Sep 5, 2024
13 checks passed
@gspowley gspowley deleted the gspowley/sc-51001/context-manager branch September 5, 2024 03:50
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.

2 participants