Repository¶
- class wrgl.repository.Repository(endpoint, id_token=None)¶
Represents the HTTP API that wraps a hosted Wrgl repository
- Parameters
endpoint (str) – the endpoint of the HTTP API
id_token (str) – optional, the access token for this API. If it is a valid token then you don’t need to run
Repository.authenticate()
.
- authenticate(email, password)¶
Authenticates and returns the access token.
If successful, access token will be saved for future usage.
- get_branch(branch)¶
Get the head commit of a branch
- commit(branch, message, file, primary_key)¶
Creates a new commit
- Parameters
branch (str) – name of the branch to commit under
message (str) – commit message
file (typing.BinaryIO) – the CSV file to commit
primary_key (list[str]) – list of column names that make up the primary key
- Return type
- get_commit_tree(head, max_depth)¶
Gets commit tree
- Parameters
- Return type
- get_commit(commit_sum)¶
Get commit with the given checksum
- get_table(table_sum)¶
Get table with the given checksum
- get_blocks(table_sum, start=None, end=None, with_column_names=True)¶
Fetch table blocks as concatenated rows. Each row as a list of strings.
Calling this with default start, end, and with_column_names will return the entire table.
- Parameters
- Return type
- get_rows(table_sum, offsets)¶
Get rows at certain offsets. Each row will be returned as a list of strings.
This is usually used in tandem with row offsets from
DiffResult
to fetch changed rows.
- diff(sum1, sum2)¶
Compares two commits and returns their differences.
- Parameters
- Return type
- diff_reader(sum1, sum2)¶
Compares two commits and interpret their differences.
This method is higher level than
Repository.diff()
and should be preferred for 99% of use cases.- Parameters
- Return type