bauplan.schema
classAPIError
classAPIErrorbauplan.schema.APIError(
*,
code: int,
type: str,
message: str,
context: dict[str,
typing.Any]
)-> None
classAPIMetadata
classAPIMetadatabauplan.schema.APIMetadata(
*,
status_code: int,
ref: Optional[Annotated[Union[bauplan.schema.Branch,
bauplan.schema.Tag,
bauplan.schema.DetachedRef],
FieldInfo(
annotation=NoneType,
required=True,
discriminator='type'
)]] = None,
username: Optional[str] = None,
error: Optional[str] = None,
pagination_token: Optional[str] = None,
request_id: str,
request_ts: int,
request_ms: int
)-> None
classAPIResponse
classAPIResponsebauplan.schema.APIResponse(
*,
metadata: bauplan.schema.APIMetadata,
ref: Optional[Annotated[Union[bauplan.schema.Branch,
bauplan.schema.Tag,
bauplan.schema.DetachedRef],
FieldInfo(
annotation=NoneType,
required=True,
discriminator='type'
)]] = None
)-> None
classAPIResponseWithData
classAPIResponseWithDatabauplan.schema.APIResponseWithData(
*,
metadata: bauplan.schema.APIMetadata,
ref: Optional[Annotated[Union[bauplan.schema.Branch,
bauplan.schema.Tag,
bauplan.schema.DetachedRef],
FieldInfo(
annotation=NoneType,
required=True,
discriminator='type'
)]] = None,
data: Any
)-> None
Bases: APIResponse
classAPIResponseWithError
classAPIResponseWithErrorbauplan.schema.APIResponseWithError(
*,
metadata: bauplan.schema.APIMetadata,
ref: Optional[Annotated[Union[bauplan.schema.Branch,
bauplan.schema.Tag,
bauplan.schema.DetachedRef],
FieldInfo(
annotation=NoneType,
required=True,
discriminator='type'
)]] = None,
error: bauplan.schema.APIError
)-> None
Bases: APIResponse
classActor
classActorbauplan.schema.Actor(
*,
name: str,
email: str | None
)-> None
classBranch
classBranchbauplan.schema.Branch(
*,
name: str,
hash: str | None = None,
type: Literal['BRANCH'] = 'BRANCH'
)-> None
Bases: Ref
classCacheDir
classCacheDirbauplan.schema.CacheDir(
*,
dirpath: pathlib.Path
)-> None
EXPERIMENTAL AND SUBJECT TO CHANGE.
CacheDir is a model for a standard bauplan directory ($HOME/.bauplan) for caching of files on the local filesystem. This is partially a convenience interface for other models such as JobContext, and partially a convenience for the user to easily clean up any cache files they no longer want (or a previous process failed to clean up).
def cleanup
def cleanupRemove the temporary cache directory and its contents.
def clear_job_cache
def clear_job_cacheRemove all directories with the '.job_snapshot' prefix from the bauplan cache.
Parameters
def save
def saveMake the temporary cache directory persistent, preventing automatic cleanup.
classCommit
classCommitA commit is a record of a change in the data lake.
Attributes
classDAGEdge
classDAGEdgebauplan.schema.DAGEdge(
*,
source_model: Optional[str],
destination_model: str
)-> None
A dependency between DAGNode instances, representing dataflow.
classDAGNode
classDAGNodebauplan.schema.DAGNode(
*,
id: str,
name: str
)-> None
A bauplan function that produces a Model.
Attributes
classDetachedRef
classDetachedRefbauplan.schema.DetachedRef(
*,
name: str,
hash: str | None = None,
type: Literal['DETACHED'] = 'DETACHED'
)-> None
Bases: Ref
classEntry
classEntrybauplan.schema.Entry(
*,
name: str,
namespace: str,
kind: str
)-> None
classGetBranchesResponse
classGetBranchesResponseAn Iterable containing Branch objects returned by get_branches method.
Example:
response = client.get_branches()
for branch in response:
print(branch.name)
classGetCommitsResponse
classGetCommitsResponseAn Iterable containing Commit objects returned by get_commits method.
classGetNamespacesResponse
classGetNamespacesResponseclassGetTablesResponse
classGetTablesResponseAn Iterable containing TableWithMetadata objects returned by get_tables method.
Example:
response = client.get_tables(namespace='my_namespace', ref='main')
for table in response:
print(table.name, table.records)
classGetTagsResponse
classGetTagsResponseclassJob
classJobbauplan.schema.Job(
*,
id: str,
kind: Union[str,
bauplan.schema.JobKind],
user: str,
human_readable_status: str,
created_at: Optional[datetime.datetime],
finished_at: Optional[datetime.datetime],
status: bauplan.schema.JobState
)-> None
EXPERIMENTAL AND SUBJECT TO CHANGE.
Job is a model for a job in the Bauplan system. It is tracked as a result of a code snapshot run.
def finished_after
def finished_afterCheck if the job finished within the given timedelta from now.
Parameters
def finished_before
def finished_beforeCheck if the job finished before the given timedelta from now.
Parameters
def finished_between
def finished_betweenCheck if the job finished between two datetimes.
Parameters
def from_proto
def from_protoParameters
def has_finished_range
def has_finished_rangeParameters
def has_id
def has_idCheck if the job has the specified ID or ID prefix.
Parameters
def has_started_range
def has_started_rangeCheck if the job started within the specified time range.
Parameters
def has_status
def has_statusCheck if the job has specified status.
Parameters
def started_after
def started_afterCheck if the job started after the given datetime.
Parameters
def started_before
def started_beforeCheck if the job started before the given datetime.
Parameters
def started_between
def started_betweenCheck if the job started between two datetimes.
Parameters
classJobContext
classJobContextbauplan.schema.JobContext(
*,
id: str,
project_id: Optional[str],
project_name: Optional[str],
ref: Optional[bauplan.schema.Ref],
tx_ref: Optional[bauplan.schema.Ref],
logs: List[bauplan.schema.JobLogEvent],
dag_nodes: List[bauplan.schema.DAGNode],
dag_edges: List[bauplan.schema.DAGEdge],
snapshot_dict: Dict[str,
str],
snapshot_dirpath: Optional[pathlib.Path]
)-> None
EXPERIMENTAL AND SUBJECT TO CHANGE.
JobContext is a model for immediate working context of a particular job. This currently includes: (1) Ref, (2) Code Snapshot, (3) Logs. A JobContext should enable a variety of workflows for iterating on an existing Job.
def cleanup_cache
def cleanup_cacheClean up the cache directory if it exists.
def save_cache
def save_cacheSave the cache directory if it exists.
classJobKind
classJobKindModels a job's "kind" or job type. May be one of: UNSPECIFIED, CODE_SNAPSHOT_RUN, QUERY, IMPORT_PLAN_CREATE, IMPORT_PLAN_APPLY, TABLE_PLAN_CREATE, TABLE_PLAN_CREATE_APPLY, or TABLE_IMPORT.
classJobLogEvent
classJobLogEventbauplan.schema.JobLogEvent(
*,
stream: Optional[bauplan.schema.JobLogStream],
level: Optional[bauplan.schema.JobLogLevel],
message: str
)-> None
EXPERIMENTAL AND SUBJECT TO CHANGE.
JobLogEvent is a model for a particular log message from a particular job.
When you output logs within a Python model, they are persisted as JobLogEvents.
classJobLogLevel
classJobLogLevelclassJobLogList
classJobLogListbauplan.schema.JobLogList(
*,
events: List[bauplan.schema.JobLogEvent]
)-> None
EXPERIMENTAL AND SUBJECT TO CHANGE.
JobLogList is a model for all of the logs from a particular job. This model is primarily provided as a convenience for "common" interactions with a job's log messages.
def error_messages
def error_messagesclassJobLogStream
classJobLogStreamclassJobState
classJobStateclassNamespace
classNamespacebauplan.schema.Namespace(
*,
name: str,
ref: Optional[Annotated[Union[bauplan.schema.Branch,
bauplan.schema.Tag,
bauplan.schema.DetachedRef],
FieldInfo(
annotation=NoneType,
required=True,
discriminator='type'
)]] = None
)-> None
classPartitionField
classPartitionFieldbauplan.schema.PartitionField(
*,
name: str,
transform: str
)-> None
classRef
classRefbauplan.schema.Ref(
*,
name: str,
hash: str | None = None,
type: str | None = None
)-> None
A branch or a tag
Examples:
ref = Ref(name='main', hash='abc123')
Attributes
def from_dict
def from_dictParameters
def from_string
def from_stringParameters
classTable
classTablebauplan.schema.Table(
*,
name: str,
namespace: str,
kind: str = 'TABLE'
)-> None
Bases: Entry
classTableField
classTableFieldbauplan.schema.TableField(
*,
id: int,
name: str,
required: bool,
type: str
)-> None
classTableWithMetadata
classTableWithMetadatabauplan.schema.TableWithMetadata(
*,
name: str,
namespace: str,
kind: str = 'TABLE',
id: str,
records: Optional[int],
size: Optional[int],
last_updated_ms: int,
fields: List[bauplan.schema.TableField],
snapshots: Optional[int],
partitions: List[bauplan.schema.PartitionField],
metadata_location: str,
current_snapshot_id: Optional[int],
current_schema_id: Optional[int],
raw: Optional[Dict]
)-> None
Bases: Table
classTag
classTagbauplan.schema.Tag(
*,
name: str,
hash: str | None = None,
type: Literal['TAG'] = 'TAG'
)-> None
Bases: Ref
def proto_datetime_to_py_datetime
def proto_datetime_to_py_datetime