-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added greate_expectation validation layer
- Loading branch information
1 parent
224999f
commit 91fe219
Showing
18 changed files
with
365 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
# stock-market-analytics-dataops | ||
# Stock Market Analytics DataOps Workflow | ||
|
||
## Projects TO-DO: | ||
- Save stocks ticker data from yahoo finance to Google BigQuery | ||
- Create a Greate Expectation Suite and Checkpoints using the Greate Expectation package to validate and test the loaded data (Test suite) | ||
- Setup A dbt-core project as a transformation layer above the source data | ||
|
Binary file not shown.
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 was deleted.
Oops, something went wrong.
File renamed without changes.
Binary file added
BIN
+208 Bytes
dags/packages/stock_data_access/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+980 Bytes
dags/packages/stock_data_access/__pycache__/stock_data.cpython-310.pyc
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from pandas_datareader import data as pd_reader | ||
import datetime as dt | ||
from pandas import DataFrame | ||
from google.oauth2 import service_account | ||
|
||
def _save_stocks_data_to_gbq(ticker, syear, smonth, sday, eyear, emonth, eday,sa_path): | ||
start = dt.datetime(syear, smonth, sday) | ||
end = dt.datetime(eyear, emonth, eday) | ||
df = pd_reader.DataReader(ticker, 'yahoo', start, end) | ||
credentials = service_account.Credentials.from_service_account_file(sa_path) | ||
df.rename(columns = {'Adj Close':'Adj_Close'}, inplace = True) | ||
df.reset_index(inplace=True) | ||
df.to_gbq( | ||
destination_table='stocks_storage.stocks_data', | ||
project_id='stocks-analytics-361812', | ||
credentials=credentials, | ||
if_exists= 'replace' | ||
) |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
uncommitted/ |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: stocks_expectations | ||
config_version: 1.0 | ||
template_name: | ||
module_name: great_expectations.checkpoint | ||
class_name: Checkpoint | ||
run_name_template: '%Y%m%d-%H%M%S-my-run-name-template' | ||
expectation_suite_name: | ||
batch_request: {} | ||
action_list: | ||
- name: store_validation_result | ||
action: | ||
class_name: StoreValidationResultAction | ||
- name: store_evaluation_params | ||
action: | ||
class_name: StoreEvaluationParametersAction | ||
- name: update_data_docs | ||
action: | ||
class_name: UpdateDataDocsAction | ||
site_names: [] | ||
evaluation_parameters: {} | ||
runtime_configuration: {} | ||
validations: | ||
- batch_request: | ||
datasource_name: dwh | ||
data_connector_name: default_inferred_data_connector_name | ||
data_asset_name: stocks_storage.stocks_data | ||
data_connector_query: | ||
index: -1 | ||
expectation_suite_name: Stocks Expectations | ||
profilers: [] | ||
ge_cloud_id: | ||
expectation_suite_ge_cloud_id: |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
store_backend_id = 02573b09-194f-4b2d-a2f4-108fb8fda974 |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"data_asset_type": null, | ||
"expectation_suite_name": "2", | ||
"expectations": [], | ||
"ge_cloud_id": null, | ||
"meta": { | ||
"great_expectations_version": "0.15.21" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
great_expectations/expectations/Expectations for stocks.json
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"data_asset_type": null, | ||
"expectation_suite_name": "Expectations for stocks", | ||
"expectations": [], | ||
"ge_cloud_id": null, | ||
"meta": { | ||
"citations": [ | ||
{ | ||
"batch_request": { | ||
"data_asset_name": "stocks.stocks-data", | ||
"data_connector_name": "default_inferred_data_connector_name", | ||
"datasource_name": "dwh", | ||
"limit": 1000 | ||
}, | ||
"citation_date": "2022-09-07T14:52:41.144021Z", | ||
"comment": "Created suite added via CLI" | ||
} | ||
], | ||
"great_expectations_version": "0.15.21" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
great_expectations/expectations/Expectations of Stocks Data.json
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"data_asset_type": null, | ||
"expectation_suite_name": "Expectations of Stocks Data", | ||
"expectations": [], | ||
"ge_cloud_id": null, | ||
"meta": { | ||
"citations": [ | ||
{ | ||
"batch_request": { | ||
"data_asset_name": "stocks_storage.stocks_data", | ||
"data_connector_name": "default_inferred_data_connector_name", | ||
"datasource_name": "dwh", | ||
"limit": 1000 | ||
}, | ||
"citation_date": "2022-09-07T15:26:06.033289Z", | ||
"comment": "Created suite added via CLI" | ||
} | ||
], | ||
"great_expectations_version": "0.15.21" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
great_expectations/expectations/Stocks Data Expectations.json
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"data_asset_type": null, | ||
"expectation_suite_name": "Stocks Data Expectations", | ||
"expectations": [], | ||
"ge_cloud_id": null, | ||
"meta": { | ||
"great_expectations_version": "0.15.21" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
"data_asset_type": null, | ||
"expectation_suite_name": "Stocks Expectations", | ||
"expectations": [ | ||
{ | ||
"expectation_type": "expect_table_column_count_to_equal", | ||
"kwargs": { | ||
"value": 7 | ||
}, | ||
"meta": {} | ||
}, | ||
{ | ||
"expectation_type": "expect_column_values_to_be_unique", | ||
"kwargs": { | ||
"column": "Date" | ||
}, | ||
"meta": {} | ||
}, | ||
{ | ||
"expectation_type": "expect_column_values_to_not_be_null", | ||
"kwargs": { | ||
"column": "Date" | ||
}, | ||
"meta": {} | ||
}, | ||
{ | ||
"expectation_type": "expect_column_values_to_be_of_type", | ||
"kwargs": { | ||
"column": "Date", | ||
"type_": "TIMESTAMP" | ||
}, | ||
"meta": {} | ||
}, | ||
{ | ||
"expectation_type": "expect_column_values_to_be_of_type", | ||
"kwargs": { | ||
"column": "High", | ||
"type_": "FLOAT" | ||
}, | ||
"meta": {} | ||
}, | ||
{ | ||
"expectation_type": "expect_column_values_to_be_of_type", | ||
"kwargs": { | ||
"column": "Low", | ||
"type_": "FLOAT" | ||
}, | ||
"meta": {} | ||
}, | ||
{ | ||
"expectation_type": "expect_column_values_to_be_of_type", | ||
"kwargs": { | ||
"column": "Open", | ||
"type_": "FLOAT" | ||
}, | ||
"meta": {} | ||
}, | ||
{ | ||
"expectation_type": "expect_column_values_to_be_of_type", | ||
"kwargs": { | ||
"column": "Close", | ||
"type_": "FLOAT" | ||
}, | ||
"meta": {} | ||
}, | ||
{ | ||
"expectation_type": "expect_column_values_to_be_of_type", | ||
"kwargs": { | ||
"column": "Adj_Close", | ||
"type_": "FLOAT" | ||
}, | ||
"meta": {} | ||
}, | ||
{ | ||
"expectation_type": "expect_column_values_to_be_of_type", | ||
"kwargs": { | ||
"column": "Volume", | ||
"type_": "INTEGER" | ||
}, | ||
"meta": {} | ||
} | ||
], | ||
"ge_cloud_id": null, | ||
"meta": { | ||
"citations": [ | ||
{ | ||
"batch_request": { | ||
"data_asset_name": "stocks_storage.stocks_data", | ||
"data_connector_name": "default_inferred_data_connector_name", | ||
"datasource_name": "dwh", | ||
"limit": 1000 | ||
}, | ||
"citation_date": "2022-09-07T15:50:23.555651Z", | ||
"comment": "Created suite added via CLI" | ||
} | ||
], | ||
"great_expectations_version": "0.15.21" | ||
} | ||
} |
Oops, something went wrong.