Pipeline and Space Management¶
In order to manage your pipelines and spaces with this SDK, you need to provide the PERSONAL_ACCESS_TOKEN
to the GlassFlow client.
from glassflow import GlassFlowClient
client = GlassFlowClient(personal_access_token="<your personal access token>")
Here is a list of operations you can do with the GlassFlowClient
:
- List Pipelines - Returns a list with all your pipelines
- Get Pipeline - Returns a pipeline object from a given pipeline ID
- Create Pipeline - Create a new pipeline
- List Spaces - Returns a list with all your spaces
- Create Space - Create a new space
You can also interact directly with the Pipeline
or Space
objects. They
allow for some extra functionalities like delete or update.
- Update Pipeline - Update an existing pipeline
- Delete Pipeline - Delete an existing pipeline
- Delete Space - Delete an existing pipeline
List Pipelines¶
Returns information about the available pipelines. It can be restricted to a
specific space by passing the space_id
.
Usage
Get Pipeline¶
Gets information about a pipeline from a given pipeline ID. It returns a Pipeline object which can be used manage the Pipeline.
Usage
Create Pipeline¶
Creates a new pipeline and returns a Pipeline
object.
Usage
Usage
In the next example we create a pipeline with Google PubSub source and a webhook sink:
from glassflow import GlassFlowClient
client = GlassFlowClient(personal_access_token="<your access token>")
pipeline = client.create_pipeline(
name="MyFirstPipeline",
space_id="<your space id>",
transformation_file="path/to/transformation.py",
source_kind="google_pubsub",
source_config={
"project_id": "<your gcp project id>",
"subscription_id": "<your subscription id>",
"credentials_json": "<your credentials json>"
},
sink_kind="webhook",
sink_config={
"url": "www.my-webhook-url.com",
"method": "POST",
"headers": [{"header1": "header1_value"}]
}
)
Update Pipeline¶
The Pipeline object has an update method.
Usage
Delete Pipeline¶
The Pipeline object has a delete method to delete a pipeline
Usage
List Spaces¶
Returns information about the available spaces.
Example Usage¶
Usage
Create Space¶
Creates a new space and returns a Space
object.
Usage
Delete Space¶
The Space object has a delete method to delete a space