Merge remote-tracking branch 'origin/development' into feature/run-ge

This commit is contained in:
Pablo Martin 2023-02-02 17:24:16 +01:00
commit 18c5a3dca8
5 changed files with 18 additions and 20 deletions

View file

@ -73,8 +73,9 @@ with Flow(...) as flow:
remote_target_host="some-host-probably-mysql",
remote_target_port=12345,
)
task_result = some_task_that_needs_the_tunnel(tunnel=tunnel)
# Tunnel is now alive. tunnel.is_active == True
close_ssh_tunnel(tunnel=tunnel)
close_ssh_tunnel(tunnel=tunnel, upstream_tasks=[task_result])
```
**Connect to a MySQL instance**
@ -82,11 +83,11 @@ with Flow(...) as flow:
from lolafect.connections import connect_to_mysql, close_mysql_connection
with Flow(...) as flow:
connection = connect_to_mysql.run(
connection = connect_to_mysql(
mysql_credentials={...}, # You probably want to get this from TEST_LOLACONFIG.DW_CREDENTIALS
)
connection.cursor().execute("SELECT 1")
close_mysql_connection.run(connection=connection)
task_result = some_task_that_needs_mysql(connection=connection)
close_mysql_connection(connection=connection, upstream_tasks=[task_result])
# Want to connect through an SSH tunnel? Open the tunnel normally and then
# override the host and port when connecting to MySQL.
@ -106,17 +107,17 @@ with Flow(...) as flow:
remote_target_port=3306,
)
connection = connect_to_mysql.run(
connection = connect_to_mysql(
mysql_credentials={...}, # You probably want to get this from TEST_LOLACONFIG.DW_CREDENTIALS
overriding_host_and_port=get_local_bind_address_from_ssh_tunnel.run(
tunnel=tunnel # This will open the connection through the SSH tunnel instead of straight to MySQL
),
)
connection.cursor().execute("SELECT 1")
close_mysql_connection.run(connection=connection)
close_ssh_tunnel.run(tunnel=tunnel)
task_result = some_task_that_needs_mysql(connection=connection)
mysql_closed = close_mysql_connection(connection=connection, upstream_tasks=[task_result])
close_ssh_tunnel.run(tunnel=tunnel, upstream_tasks=[mysql_closed])
```
### Use Great Expectations