This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Snowflake Query Execution [#73] #104
Merged
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
07bed10
fixtures for Snowflake datasets
567a1ce
update key
18620e2
use snowflake connector for snowflake dbs
6da4210
adds fixture for integration config
aeeb0a9
set secrets on the Snowflake connection config if available
716153d
add initial test for Snowflake privacy request
3c1fdfe
extend SQLQueryConfig to cater to Snowflake dialect
fe91118
Merge branch 'main' into seanpreston-73-snowflake-execution
a9267cb
adds docstrings
27c4084
add snowflake test dataset
1334cbd
fix typechecks
95d32df
fix expected return counts
50ba838
update statement formatting for snowflake
40231c2
fix key, add secrets
0dc3094
update customer name
527f81f
conflict resolution
ef26eb8
Merge branch 'main' into seanpreston-73-snowflake-execution
9190fc9
adds docstring
e11338b
ensure deleting connection configs removes related datasets
2e10b37
handle snowflake
da53475
update methodology for testing datasets, delete privacy request once …
1b0b4c9
fix return types
6452245
use correct mark
793d39a
only give snowflake secrets in external tests
23a5b89
remove expunge_all in favour of checking session membership
8fd5872
fix collection name
353053a
adds snowflake update statement generation and IN handling
869df1d
add hide_parameters option thats set by env var
2fe7a91
listen to self.hide_parameters
a6140b4
add another change in the logger to check for env var
2496783
add test for snowflake erasure on a specific category
689a44f
delete data from snowflake after we're finished with it
00b99ba
group snowflake resources into a fixture
43cd8c2
use correct formatting in queries and identity submissions
cace39d
Merge branch 'main' into seanpreston-73-snowflake-execution
7511980
format input data correctly
ce09591
add datatypes
5c20fff
fix refs to os.getenv
cc64399
adds docstrings
92981ff
remove parens
2b2efe2
toggle env var to check PII masking
272d733
remove extra whitespace
b3224d2
add scope to fixture
4acfea3
variant support
9285cd3
remove expunge_all in new file
043b032
remove copypasta
def2484
add docstring
8624fb3
add config.is_test_mode, remove superfluous name
1625ed1
remove circular dependency
c023f63
remove unused imports and fixtures
3241ed9
correct var names, allow fixture to proceed without secrets
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,229 @@ | ||
dataset: | ||
- fides_key: snowflake_example_test_dataset | ||
name: Snowflake Example Test Dataset | ||
description: Example of a Snowflake dataset containing a variety of related tables like customers, products, addresses, etc. | ||
collections: | ||
- name: address | ||
fields: | ||
- name: city | ||
data_categories: [user.provided.identifiable.contact.city] | ||
- name: house | ||
data_categories: [user.provided.identifiable.contact.street] | ||
- name: id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
primary_key: True | ||
- name: state | ||
data_categories: [user.provided.identifiable.contact.state] | ||
- name: street | ||
data_categories: [user.provided.identifiable.contact.street] | ||
- name: zip | ||
data_categories: [user.provided.identifiable.contact.postal_code] | ||
|
||
- name: customer | ||
fields: | ||
- name: address_id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
references: | ||
- dataset: snowflake_example_test_dataset | ||
field: address.id | ||
direction: to | ||
- name: created | ||
data_categories: [system.operations] | ||
- name: email | ||
data_categories: [user.provided.identifiable.contact.email] | ||
fidesops_meta: | ||
identity: email | ||
seanpreston marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data_type: string | ||
- name: id | ||
data_categories: [user.derived.identifiable.unique_id] | ||
fidesops_meta: | ||
primary_key: True | ||
- name: name | ||
data_categories: [user.provided.identifiable.name] | ||
fidesops_meta: | ||
data_type: string | ||
length: 40 | ||
- name: variant_eg | ||
# We use this data category so we can target this column from | ||
# our Snowflake tests | ||
data_categories: [user.provided.identifiable.name] | ||
pattisdr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: employee | ||
fields: | ||
- name: address_id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
references: | ||
- dataset: snowflake_example_test_dataset | ||
field: address.id | ||
direction: to | ||
- name: email | ||
data_categories: [user.provided.identifiable.contact.email] | ||
fidesops_meta: | ||
identity: email | ||
data_type: string | ||
- name: id | ||
data_categories: [user.derived.identifiable.unique_id] | ||
fidesops_meta: | ||
primary_key: True | ||
- name: name | ||
data_categories: [user.provided.identifiable.name] | ||
fidesops_meta: | ||
data_type: string | ||
|
||
- name: login | ||
fields: | ||
- name: customer_id | ||
data_categories: [user.derived.identifiable.unique_id] | ||
fidesops_meta: | ||
references: | ||
- dataset: snowflake_example_test_dataset | ||
field: customer.id | ||
direction: from | ||
- name: id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
primary_key: True | ||
- name: time | ||
data_categories: [user.derived.nonidentifiable.sensor] | ||
|
||
- name: order | ||
fields: | ||
- name: customer_id | ||
data_categories: [user.derived.identifiable.unique_id] | ||
fidesops_meta: | ||
references: | ||
- dataset: snowflake_example_test_dataset | ||
field: customer.id | ||
direction: from | ||
- name: id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
primary_key: True | ||
- name: shipping_address_id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
references: | ||
- dataset: snowflake_example_test_dataset | ||
field: address.id | ||
direction: to | ||
|
||
# order_item | ||
- name: order_item | ||
fields: | ||
- name: order_id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
references: | ||
- dataset: snowflake_example_test_dataset | ||
field: order.id | ||
direction: from | ||
- name: product_id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
references: | ||
- dataset: snowflake_example_test_dataset | ||
field: product.id | ||
direction: to | ||
- name: quantity | ||
data_categories: [system.operations] | ||
|
||
- name: payment_card | ||
fields: | ||
- name: billing_address_id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
references: | ||
- dataset: snowflake_example_test_dataset | ||
field: address.id | ||
direction: to | ||
- name: ccn | ||
data_categories: [user.provided.identifiable.financial.account_number] | ||
- name: code | ||
data_categories: [user.provided.identifiable.financial] | ||
- name: customer_id | ||
data_categories: [user.derived.identifiable.unique_id] | ||
fidesops_meta: | ||
references: | ||
- dataset: snowflake_example_test_dataset | ||
field: customer.id | ||
direction: from | ||
- name: id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
primary_key: True | ||
- name: name | ||
data_categories: [user.provided.identifiable.financial] | ||
- name: preferred | ||
data_categories: [user.provided.nonidentifiable] | ||
|
||
- name: product | ||
fields: | ||
- name: id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
primary_key: True | ||
- name: name | ||
data_categories: [system.operations] | ||
- name: price | ||
data_categories: [system.operations] | ||
|
||
- name: report | ||
fields: | ||
- name: email | ||
data_categories: [user.provided.identifiable.contact.email] | ||
fidesops_meta: | ||
identity: email | ||
data_type: string | ||
- name: id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
primary_key: True | ||
- name: month | ||
data_categories: [system.operations] | ||
- name: name | ||
data_categories: [system.operations] | ||
- name: total_visits | ||
data_categories: [system.operations] | ||
- name: year | ||
data_categories: [system.operations] | ||
|
||
- name: service_request | ||
fields: | ||
- name: alt_email | ||
data_categories: [user.provided.identifiable.contact.email] | ||
fidesops_meta: | ||
identity: email | ||
data_type: string | ||
- name: closed | ||
data_categories: [system.operations] | ||
- name: email | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
identity: email | ||
data_type: string | ||
- name: employee_id | ||
data_categories: [user.derived.identifiable.unique_id] | ||
fidesops_meta: | ||
references: | ||
- dataset: snowflake_example_test_dataset | ||
field: employee.id | ||
direction: from | ||
- name: id | ||
data_categories: [system.operations] | ||
fidesops_meta: | ||
primary_key: True | ||
- name: opened | ||
data_categories: [system.operations] | ||
|
||
- name: visit | ||
fields: | ||
- name: email | ||
data_categories: [user.provided.identifiable.contact.email] | ||
fidesops_meta: | ||
identity: email | ||
data_type: string | ||
- name: last_visit | ||
data_categories: [system.operations] |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we're thinking about test fixtures for these different datasources, it would be nice to create some interdependency between them, like how the mongo example test dataset relies on a field in the postgres example test dataset, I don't think our datasets should all be completely independent datastores.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have the postman collection be able to make requests against our fidesops snowflake db - but the way i understand it, we wipe and repopulate it from these unit tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite — we're only wiping and repopulating the data we use in erasures. Everything else is part of a copy of the dataset Atlas uses for Snowflake. There are some frustrating minor differences here, for example, in Snowflake the collection is
order
and in Postgres it'sorders
plural.I'll factor this into the testing design for sure! Thanks