-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
388 additions
and
49 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Improve run times for large projects by reusing connections by default | ||
time: 2024-07-09T19:43:16.489649-04:00 | ||
custom: | ||
Author: mikealfare amardatar | ||
Issue: "1082" |
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,6 @@ | ||
kind: Features | ||
body: Improve run times when using key pair auth by caching the private key | ||
time: 2024-07-10T17:23:45.046905-04:00 | ||
custom: | ||
Author: mikealfare aranke | ||
Issue: "1082" |
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,6 @@ | ||
kind: Fixes | ||
body: Use show ... starts with instead of show ... like in _show_object_metadata | ||
time: 2024-07-05T16:59:32.087555+01:00 | ||
custom: | ||
Author: aranke | ||
Issue: "1102" |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import base64 | ||
import sys | ||
from typing import Optional | ||
|
||
if sys.version_info < (3, 9): | ||
from functools import lru_cache | ||
|
||
cache = lru_cache(maxsize=None) | ||
else: | ||
from functools import cache | ||
|
||
from cryptography.hazmat.backends import default_backend | ||
from cryptography.hazmat.primitives import serialization | ||
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey | ||
|
||
|
||
@cache | ||
def private_key_from_string( | ||
private_key_string: str, passphrase: Optional[str] = None | ||
) -> RSAPrivateKey: | ||
|
||
if passphrase: | ||
encoded_passphrase = passphrase.encode() | ||
else: | ||
encoded_passphrase = None | ||
|
||
if private_key_string.startswith("-"): | ||
return serialization.load_pem_private_key( | ||
data=bytes(private_key_string, "utf-8"), | ||
password=encoded_passphrase, | ||
backend=default_backend(), | ||
) | ||
return serialization.load_der_private_key( | ||
data=base64.b64decode(private_key_string), | ||
password=encoded_passphrase, | ||
backend=default_backend(), | ||
) | ||
|
||
|
||
@cache | ||
def private_key_from_file( | ||
private_key_path: str, passphrase: Optional[str] = None | ||
) -> RSAPrivateKey: | ||
|
||
if passphrase: | ||
encoded_passphrase = passphrase.encode() | ||
else: | ||
encoded_passphrase = None | ||
|
||
with open(private_key_path, "rb") as file: | ||
private_key_bytes = file.read() | ||
|
||
return serialization.load_pem_private_key( | ||
data=private_key_bytes, | ||
password=encoded_passphrase, | ||
backend=default_backend(), | ||
) |
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
File renamed without changes.
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,26 @@ | ||
import os | ||
|
||
from dbt.tests.util import run_dbt | ||
import pytest | ||
|
||
|
||
class TestKeyPairAuth: | ||
@pytest.fixture(scope="class", autouse=True) | ||
def dbt_profile_target(self): | ||
return { | ||
"type": "snowflake", | ||
"threads": 4, | ||
"account": os.getenv("SNOWFLAKE_TEST_ACCOUNT"), | ||
"user": os.getenv("SNOWFLAKE_TEST_USER"), | ||
"private_key": os.getenv("SNOWFLAKE_TEST_PRIVATE_KEY"), | ||
"private_key_passphrase": os.getenv("SNOWFLAKE_TEST_PRIVATE_KEY_PASSPHRASE"), | ||
"database": os.getenv("SNOWFLAKE_TEST_DATABASE"), | ||
"warehouse": os.getenv("SNOWFLAKE_TEST_WAREHOUSE"), | ||
} | ||
|
||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return {"my_model.sql": "select 1 as id"} | ||
|
||
def test_connection(self, project): | ||
run_dbt() |
File renamed without changes.
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,6 @@ | ||
# Performance testing | ||
|
||
These tests are not meant to run on a regular basis; instead, they are tools for measuring performance impacts of changes as needed. | ||
We often get requests for reducing processing times, researching why a particular component is taking longer to run than expected, etc. | ||
In the past we have performed one-off analyses to address these requests and documented the results in the relevant PR (when a change is made). | ||
It is more useful to document those analyses in the form of performance tests so that we can easily rerun the analysis at a later date. |
Oops, something went wrong.