Skip to content

Commit

Permalink
ENG-2640: MySQL periodic integration test (#1179)
Browse files Browse the repository at this point in the history
Sets up MySQL data integration tests to run periodically.

Co-authored-by: Andre Giron <[email protected]>
  • Loading branch information
agiron123 and Andre Giron authored Apr 14, 2023
1 parent d1d84cb commit 003bf75
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/workflows/periodic-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,23 @@ jobs:
timeout-minutes: 60
name: SDK Integration Tests against Data Connectors
services:
mysql:
image: mysql:8.0
env:
MYSQL_USER: aqueduct
MYSQL_PASSWORD: Password123!
MYSQL_DATABASE: aqueducttest
MYSQL_ROOT_PASSWORD: Password123!
ports:
# Maps tcp port 3306 on service container to the host
- 3306:3306
options: >-
--name=mysql
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
postgres:
image: postgres:15
env:
Expand Down
1 change: 1 addition & 0 deletions integration_tests/sdk/data_integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ServiceType.SQLITE,
ServiceType.SNOWFLAKE,
ServiceType.MARIADB,
ServiceType.MYSQL,
],
"s3_test": [ServiceType.S3],
"mongo_db_test": [ServiceType.MONGO_DB],
Expand Down
7 changes: 7 additions & 0 deletions integration_tests/sdk/setup_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ def _setup_postgres_db():
_execute_command(["aqueduct", "install", "postgres"])


def _setup_mysql_db():
_execute_command(["aqueduct", "install", "mysql"])


def _setup_relational_data(client: Client, db: RelationalDBIntegration) -> None:
# Find all the tables that already exist.
existing_table_names = set(db.list_tables()["tablename"])
Expand Down Expand Up @@ -219,6 +223,9 @@ def setup_data_integrations(client: Client, filter_to: Optional[str] = None) ->
if integration_config["type"] == ServiceType.POSTGRES:
_setup_postgres_db()

if integration_config["type"] == ServiceType.MYSQL:
_setup_mysql_db()

client.connect_integration(
integration_name,
integration_config["type"],
Expand Down
3 changes: 2 additions & 1 deletion sdk/aqueduct/integrations/sql_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

LIST_TABLES_QUERY_PG = "SELECT tablename, tableowner FROM pg_catalog.pg_tables WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema';"
LIST_TABLES_QUERY_SNOWFLAKE = "SELECT table_name AS \"tablename\", table_owner AS \"tableowner\" FROM information_schema.tables WHERE table_schema != 'INFORMATION_SCHEMA' AND table_type = 'BASE TABLE';"
LIST_TABLES_QUERY_MYSQL = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_type = 'BASE TABLE' AND table_schema NOT IN ('mysql', 'sys', 'performance_schema');"
LIST_TABLES_QUERY_MYSQL = "SELECT table_name AS tablename FROM INFORMATION_SCHEMA.TABLES WHERE table_type = 'BASE TABLE' AND table_schema NOT IN ('mysql', 'sys', 'performance_schema');"
LIST_TABLES_QUERY_MARIADB = "SELECT table_name AS \"tablename\" FROM INFORMATION_SCHEMA.TABLES WHERE table_type = 'BASE TABLE' AND table_schema NOT IN ('mysql', 'sys', 'performance_schema');"

LIST_TABLES_QUERY_SQLSERVER = (
Expand All @@ -53,6 +53,7 @@ def list_tables(self) -> pd.DataFrame:
Returns:
pd.DataFrame of available tables.
"""

if self.type() in [ServiceType.BIGQUERY, ServiceType.SNOWFLAKE]:
# Use the list integration objects endpoint instead of
# providing a hardcoded SQL query to execute
Expand Down

0 comments on commit 003bf75

Please sign in to comment.