Skip to content

Commit

Permalink
Feature/embeddings (#99)
Browse files Browse the repository at this point in the history
embeddings api support
  • Loading branch information
georgiannajames authored Feb 3, 2025
1 parent 2cc3c5f commit 356dd9e
Show file tree
Hide file tree
Showing 22 changed files with 3,337 additions and 1,654 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyfusion"
version = "2.0.6"
version = "2.0.7-dev0"
edition = "2021"


Expand Down
2 changes: 1 addition & 1 deletion py_src/fusion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Fusion Devs"""
__email__ = "[email protected]"
__version__ = "2.0.6"
__version__ = "2.0.7-dev0"

from fusion._fusion import FusionCredentials
from fusion.fs_sync import fsync
Expand Down
22 changes: 9 additions & 13 deletions py_src/fusion/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def _use_client(self, client: Fusion | None) -> Fusion:
if res is None:
raise ValueError("A Fusion client object is required.")
return res

@classmethod
def _from_series(
cls: type[Attribute],
Expand Down Expand Up @@ -436,7 +436,7 @@ def delete(
resp = client.session.delete(url)
requests_raise_for_status(resp)
return resp if return_resp_obj else None

def set_lineage(
self,
attributes: list[Attribute],
Expand Down Expand Up @@ -479,22 +479,18 @@ def set_lineage(
if attribute.application_id is None:
raise ValueError(f"The 'application_id' attribute is required for setting lineage.")
attr_dict = {
"catalog": catalog,
"attribute": attribute.identifier,
"applicationId": attribute.application_id
}
"catalog": catalog,
"attribute": attribute.identifier,
"applicationId": attribute.application_id,
}
target_attributes.append(attr_dict)

url = f"{client.root_url}catalogs/{catalog}/attributes/lineage"
data = [
{
"source": {
"catalog": catalog,
"attribute": self.identifier,
"applicationId": self.application_id
},
"targets": target_attributes
}
"source": {"catalog": catalog, "attribute": self.identifier, "applicationId": self.application_id},
"targets": target_attributes,
}
]
resp = client.session.post(url, json=data)
requests_raise_for_status(resp)
Expand Down
3 changes: 3 additions & 0 deletions py_src/fusion/dataflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class DataFlow(Dataset):
type_ (str | None): The type of dataset. Defaults to "Flow".
"""

producer_application_id: dict[str, str] | None = None
consumer_application_id: list[dict[str, str]] | dict[str, str] | None = None
flow_details: dict[str, str] | None = None
Expand Down Expand Up @@ -77,6 +78,7 @@ def add_registered_attribute(
@dataclass
class InputDataFlow(DataFlow):
"""InputDataFlow class for maintaining input data flow metadata."""

flow_details: dict[str, str] | None = field(default_factory=lambda: {"flowDirection": "Input"})

def __repr__(self: InputDataFlow) -> str:
Expand All @@ -93,6 +95,7 @@ def __repr__(self: InputDataFlow) -> str:
@dataclass
class OutputDataFlow(DataFlow):
"""OutputDataFlow class for maintaining output data flow metadata."""

flow_details: dict[str, str] | None = field(default_factory=lambda: {"flowDirection": "Output"})

def __repr__(self: OutputDataFlow) -> str:
Expand Down
3 changes: 1 addition & 2 deletions py_src/fusion/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Dataset(metaclass=CamelCaseMeta):
is_highly_confidential (bool | None, optional): is_highly_confidential. Defaults to None.
is_active (bool | None, optional): is_active. Defaults to None.
owners (list[str] | None, optional): The owners of the dataset. Defaults to None.
application_id (str | dict[str, str] | None, optional): The application (most commonly seal ID) that the
application_id (str | dict[str, str] | None, optional): The application (most commonly seal ID) that the
dataset/report/flow is owned by. Accepts string format for seal IDs, or a dictionary containing 'id' and
'type' as keys. Defaults to None.
_client (Any, optional): A Fusion client object. Defaults to None.
Expand Down Expand Up @@ -585,7 +585,6 @@ def create(
if data.get("report", None) and data["report"]["tier"] == "":
raise ValueError("Tier cannot be blank for reports.")


url = f"{client.root_url}catalogs/{catalog}/datasets/{self.identifier}"
resp: requests.Response = client.session.post(url, json=data)
requests_raise_for_status(resp)
Expand Down
Loading

0 comments on commit 356dd9e

Please sign in to comment.