Skip to content

Commit

Permalink
#83: Add encryption and ignore SSL verification to pyexasol.connect c…
Browse files Browse the repository at this point in the history
…alls
  • Loading branch information
tkilias authored Aug 21, 2023
1 parent b68bd0b commit 16e9fad
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
25 changes: 16 additions & 9 deletions exasol_sagemaker_extension/deployment/deploy_create_statements.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import logging
import ssl

import pyexasol
from exasol_sagemaker_extension.deployment import constants
from exasol_sagemaker_extension.deployment.\
from exasol_sagemaker_extension.deployment. \
generate_create_statement_autopilot_endpoint_deletion \
import AutopilotEndpointDeletionLuaScriptCreateStatementGenerator
from exasol_sagemaker_extension.deployment.\
from exasol_sagemaker_extension.deployment. \
generate_create_statement_autopilot_job_status_polling import \
AutopilotJobStatusPollingLuaScriptCreateStatementGenerator
from exasol_sagemaker_extension.deployment. \
generate_create_statement_autopilot_training \
import AutopilotTrainingLuaScriptCreateStatementGenerator
from exasol_sagemaker_extension.deployment.\
from exasol_sagemaker_extension.deployment. \
generate_create_statement_autopilot_endpoint_deployment \
import AutopilotEndpointDeploymentLuaScriptCreateStatementGenerator

Expand All @@ -37,7 +39,12 @@ def __init__(self, db_host: str, db_port: str, db_user: str, db_pass: str,
host=self._db_host, port=self._db_port),
user=self._db_user,
password=self._db_pass,
compression=True)
compression=True,
encryption=True,
websocket_sslopt={
"cert_reqs": ssl.CERT_NONE,
}
)

@property
def statement_maps(self):
Expand All @@ -55,16 +62,16 @@ def statement_maps(self):
stmt_lua_texts = {
"Create statement of autopilot training lua script":
constants.CREATE_STATEMENT_AUTOPILOT_TRAINING_LUA_SCRIPT_PATH.
read_text(),
read_text(),
"Create statement of autopilot job status polling lua script":
constants.CREATE_STATEMENT_AUTOPILOT_JOB_STATUS_POLLING_LUA_SCRIPT_PATH.
read_text(),
read_text(),
"Create statement of autopilot endpoint deployment lua script":
constants.CREATE_STATEMENT_AUTOPILOT_ENDPOINT_DEPLOYMENT_LUA_SCRIPT_PATH.
read_text(),
read_text(),
"Create statement of autopilot endpoint deletion lua script":
constants.CREATE_STATEMENT_AUTOPILOT_ENDPOINT_DELETION_LUA_SCRIPT_PATH.
read_text(),
read_text(),
}

stmt_create_table_texts = {
Expand Down Expand Up @@ -123,4 +130,4 @@ def create_statements():
stmt_generator = generator()
stmt_generator.save_statement()
logger.debug(f"{stmt_generator.__class__.__name__} "
"is created and saved.")
"is created and saved.")
9 changes: 8 additions & 1 deletion tests/ci_tests/fixtures/database_connection_fixture.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ssl

import pyexasol
import pytest
from tests.ci_tests.utils.parameters import db_params
Expand All @@ -10,6 +12,11 @@ def db_conn():
host=db_params.host,
port=db_params.port),
user=db_params.user,
password=db_params.password)
password=db_params.password,
encryption=True,
websocket_sslopt={
"cert_reqs": ssl.CERT_NONE,
}
)

return conn
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ssl

import pyexasol
import pytest
from tests.integration_tests.utils.parameters import db_params
Expand All @@ -10,6 +12,11 @@ def db_conn():
host=db_params.host,
port=db_params.port),
user=db_params.user,
password=db_params.password)
password=db_params.password,
encryption=True,
websocket_sslopt={
"cert_reqs": ssl.CERT_NONE,
}
)

return conn

0 comments on commit 16e9fad

Please sign in to comment.