-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from no10ds/release/v7.0.8-v0.1.6
Release - v7.0.8 (API) v0.1.6 (SDK)
- Loading branch information
Showing
22 changed files
with
374 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ httpx | |
jinja2 | ||
pandas | ||
psutil | ||
pyarrow | ||
pyjwt | ||
pydantic[email] | ||
python-multipart | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ | |
from pathlib import Path | ||
from unittest.mock import patch | ||
|
||
import pandas as pd | ||
import pyarrow as pa | ||
import pyarrow.parquet as pq | ||
import pytest | ||
|
||
from api.application.services.schema_infer_service import SchemaInferService | ||
|
@@ -67,6 +70,44 @@ def test_infer_schema(self): | |
assert actual_schema == expected_schema | ||
os.remove(temp_out_path) | ||
|
||
def test_infer_schema_with_date(self): | ||
expected_schema = Schema( | ||
metadata=SchemaMetadata( | ||
layer="raw", | ||
domain="mydomain", | ||
dataset="mydataset", | ||
sensitivity="PUBLIC", | ||
owners=[Owner(name="change_me", email="[email protected]")], | ||
), | ||
columns=[ | ||
Column( | ||
name="colname1", | ||
partition_index=None, | ||
data_type="string", | ||
allow_null=True, | ||
format=None, | ||
), | ||
Column( | ||
name="colname2", | ||
partition_index=None, | ||
data_type="date", | ||
allow_null=True, | ||
format="%Y-%m-%d", | ||
), | ||
], | ||
).dict(exclude={"metadata": {"version"}}) | ||
df = pd.DataFrame(data={"colname1": ["something"], "colname2": ["2021-01-01"]}) | ||
df["colname2"] = pd.to_datetime(df["colname2"]) | ||
temp_out_path = tempfile.mkstemp(suffix=".parquet")[1] | ||
path = Path(temp_out_path) | ||
pq.write_table(pa.Table.from_pandas(df), path) | ||
|
||
actual_schema = self.infer_schema_service.infer_schema( | ||
"raw", "mydomain", "mydataset", "PUBLIC", path | ||
) | ||
assert actual_schema == expected_schema | ||
os.remove(temp_out_path) | ||
|
||
@patch("api.application.services.schema_infer_service.construct_chunked_dataframe") | ||
def test_raises_error_when_parsing_provided_file_fails( | ||
self, mock_construct_chunked_dataframe | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ requests | |
requests-mock | ||
twine | ||
pydantic | ||
pyarrow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,13 @@ | |
|
||
setup( | ||
name="rapid-sdk", | ||
version="0.1.5", | ||
version="0.1.6", | ||
description="A python sdk for the rAPId API", | ||
url="https://github.com/no10ds/rapid-sdk", | ||
author="Lewis Card", | ||
author_email="[email protected]", | ||
license="MIT", | ||
packages=find_packages(include=["rapid", "rapid.*"], exclude=["tests"]), | ||
install_requires=["pandas", "requests", "deepdiff"], | ||
install_requires=["pandas", "requests", "deepdiff", "pyarrow", "pydantic"], | ||
include_package_data=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.