-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel' into reorder_sidebar
- Loading branch information
Showing
81 changed files
with
4,185 additions
and
984 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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Tests destinations that can run without credentials. | ||
# i.e. local postgres, duckdb, filesystem (with local fs/memory bucket) | ||
|
||
name: dest | sqlalchemy mysql and sqlite | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- devel | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
# NOTE: this workflow can't use github secrets! | ||
# DLT_SECRETS_TOML: ${{ secrets.DLT_SECRETS_TOML }} | ||
|
||
RUNTIME__SENTRY_DSN: https://[email protected]/4504819859914752 | ||
RUNTIME__LOG_LEVEL: ERROR | ||
RUNTIME__DLTHUB_TELEMETRY_ENDPOINT: ${{ secrets.RUNTIME__DLTHUB_TELEMETRY_ENDPOINT }} | ||
ACTIVE_DESTINATIONS: "[\"sqlalchemy\"]" | ||
ALL_FILESYSTEM_DRIVERS: "[\"memory\", \"file\"]" | ||
|
||
jobs: | ||
get_docs_changes: | ||
name: docs changes | ||
uses: ./.github/workflows/get_docs_changes.yml | ||
|
||
run_loader: | ||
name: dest | sqlalchemy mysql and sqlite | ||
needs: get_docs_changes | ||
if: needs.get_docs_changes.outputs.changes_outside_docs == 'true' | ||
strategy: | ||
fail-fast: false | ||
# Run on sqlalchemy 1.4 and 2.0 | ||
matrix: | ||
sqlalchemy: [1.4, 2] | ||
defaults: | ||
run: | ||
shell: bash | ||
runs-on: "ubuntu-latest" | ||
|
||
# Service containers to run with `container-job` | ||
services: | ||
# Label used to access the service container | ||
mysql: | ||
image: mysql:8 | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: dlt_data | ||
MYSQL_USER: loader | ||
MYSQL_PASSWORD: loader | ||
ports: | ||
- 3306:3306 | ||
# Wait for the service to be ready before completing the job | ||
options: >- | ||
--health-cmd="mysqladmin ping -h localhost -u root -proot" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=5 | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@master | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10.x" | ||
|
||
- name: Install Poetry | ||
uses: snok/[email protected] | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-local-destinations | ||
|
||
- name: Install dependencies | ||
run: poetry install --no-interaction -E parquet -E filesystem -E sqlalchemy -E cli --with sentry-sdk --with pipeline && poetry run pip install mysqlclient && poetry run pip install "sqlalchemy==${{ matrix.sqlalchemy }}" | ||
|
||
- name: create secrets.toml | ||
run: pwd && echo "$DLT_SECRETS_TOML" > tests/.dlt/secrets.toml | ||
|
||
# always run full suite, also on branches | ||
- run: poetry run pytest tests/load -x --ignore tests/load/sources | ||
name: Run tests Linux | ||
env: | ||
DESTINATION__SQLALCHEMY_MYSQL__CREDENTIALS: mysql://root:[email protected]:3306/dlt_data # Use root cause we need to create databases | ||
DESTINATION__SQLALCHEMY_SQLITE__CREDENTIALS: sqlite:///_storage/dl_data.sqlite |
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,69 @@ | ||
from typing import Any, Dict, Optional | ||
|
||
from dlt.common.typing import TSecretStrValue, DictStrAny | ||
from dlt.common.configuration.specs.base_configuration import CredentialsConfiguration, configspec | ||
|
||
|
||
@configspec | ||
class SFTPCredentials(CredentialsConfiguration): | ||
"""Credentials for SFTP filesystem, compatible with fsspec SFTP protocol. | ||
Authentication is attempted in the following order of priority: | ||
- `key_filename` may contain OpenSSH public certificate paths | ||
as well as regular private-key paths; when files ending in `-cert.pub` are found, they are assumed to match | ||
a private key, and both components will be loaded. | ||
- Any key found through an SSH agent: any “id_rsa”, “id_dsa”, or “id_ecdsa” key discoverable in ~/.ssh/. | ||
- Plain username/password authentication, if a password was provided. | ||
- If a private key requires a password to unlock it, and a password is provided, that password will be used to | ||
attempt to unlock the key. | ||
For more information about parameters: | ||
https://docs.paramiko.org/en/3.3/api/client.html#paramiko.client.SSHClient.connect | ||
""" | ||
|
||
sftp_port: Optional[int] = 22 | ||
sftp_username: Optional[str] = None | ||
sftp_password: Optional[TSecretStrValue] = None | ||
sftp_key_filename: Optional[str] = None | ||
sftp_key_passphrase: Optional[TSecretStrValue] = None | ||
sftp_timeout: Optional[float] = None | ||
sftp_banner_timeout: Optional[float] = None | ||
sftp_auth_timeout: Optional[float] = None | ||
sftp_channel_timeout: Optional[float] = None | ||
sftp_allow_agent: Optional[bool] = True | ||
sftp_look_for_keys: Optional[bool] = True | ||
sftp_compress: Optional[bool] = False | ||
sftp_gss_auth: Optional[bool] = False | ||
sftp_gss_kex: Optional[bool] = False | ||
sftp_gss_deleg_creds: Optional[bool] = True | ||
sftp_gss_host: Optional[str] = None | ||
sftp_gss_trust_dns: Optional[bool] = True | ||
|
||
def to_fsspec_credentials(self) -> Dict[str, Any]: | ||
"""Return a dict that can be passed to fsspec SFTP/SSHClient.connect method.""" | ||
|
||
credentials: Dict[str, Any] = { | ||
"port": self.sftp_port, | ||
"username": self.sftp_username, | ||
"password": self.sftp_password, | ||
"key_filename": self.sftp_key_filename, | ||
"passphrase": self.sftp_key_passphrase, | ||
"timeout": self.sftp_timeout, | ||
"banner_timeout": self.sftp_banner_timeout, | ||
"auth_timeout": self.sftp_auth_timeout, | ||
"channel_timeout": self.sftp_channel_timeout, | ||
"allow_agent": self.sftp_allow_agent, | ||
"look_for_keys": self.sftp_look_for_keys, | ||
"compress": self.sftp_compress, | ||
"gss_auth": self.sftp_gss_auth, | ||
"gss_kex": self.sftp_gss_kex, | ||
"gss_deleg_creds": self.sftp_gss_deleg_creds, | ||
"gss_host": self.sftp_gss_host, | ||
"gss_trust_dns": self.sftp_gss_trust_dns, | ||
} | ||
|
||
return credentials |
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.