Repository: dbeatty10/dbt-mysql (language: python)

Issue:
Test with current versions of MariaDB



Discussion / hints:
## Attempt
I did a quick tests of MariaDB 10.5 (with both dbt 0.19.0rc1 and 0.18.1) using the mysql-connector-python driver.

## Result
Neither worked out-of-the-box.

## Next steps
The best move might be to give MariaDB a stand-alone GitHub repository.

An alternative would be keep it within the `dbt-mysql` package, but create a separate `mariadb` adapter.

Either way, we'll probably need to install the [mariadb](https://mariadb.com/resources/blog/how-to-connect-python-programs-to-mariadb/) package from PyPi.




[This MariaDB bug](https://jira.mariadb.org/browse/MDEV-22781) is a bit of a show-stopper. It will affect any ephemeral models used within a view.

"A fix for this bug was pushed into 10.2", but I'm not sure if this fix has made it into any public releases by MariaDB yet.
From 2021-02-22: [MariaDB 10.5.9, 10.4.18, 10.3.28 and 10.2.37 now available](https://mariadb.org/mariadb-10-5-9-10-4-18-10-3-28-and-10-2-37-now-available/).

This should fix [this bug](https://jira.mariadb.org/browse/MDEV-22781):
![image](https://user-images.githubusercontent.com/44704949/109012221-00b15080-766f-11eb-8c89-3bca1abd36e7.png)

Hi @dbeatty10!

Sorry 🤷‍♂️ for troubling you.
If you know, can you share your plans about MariaDB? It is going in the dbt-mariadb direction or integrating in dbt-mysql?

Best regards

Fix patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index fbb9612..9c7686d 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -54,6 +54,28 @@ jobs:
       - store_artifacts:
           path: ./logs
 
+  integration-mariadb-10-5:
+    environment:
+      DBT_INVOCATION_ENV: circle
+      DBT_MYSQL_SERVER_NAME: mariadb-server-10-5
+    docker:
+      - image: fishtownanalytics/test-container:9
+      - image: mariadb:10.5
+        environment:
+          MYSQL_ROOT_PASSWORD: dbt
+        name: mariadb-server-10-5
+    steps:
+      - checkout
+      - run:
+          name: Wait for MariaDB
+          command: dockerize -wait tcp://mariadb-server-10-5:3306 -timeout 5m -wait-retry-interval 5s
+      - run:
+          name: Run integration tests
+          command: tox -e integration-mariadb-10.5
+          no_output_timeout: 1h
+      - store_artifacts:
+          path: ./logs
+
 workflows:
   version: 2
   test-everything:
@@ -65,3 +87,6 @@ workflows:
       - integration-5-7:
           requires:
             - unit
+      - integration-mariadb-10-5:
+          requires:
+            - unit
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2fb1a60..68e15d5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
 ## Unreleased (TBD)
 - Integration tests for MySQL 5.7 ([#70](https://github.com/dbeatty10/dbt-mysql/issues/70), [#71](https://github.com/dbeatty10/dbt-mysql/pull/71))
+- Integration tests for MariaDB 10.5 ([#72](https://github.com/dbeatty10/dbt-mysql/pull/72))
 
 ## dbt-mysql 0.19.0.1 (February 19, 2022)
 - Optional `ssl_disabled` property ([#67](https://github.com/dbeatty10/dbt-mysql/pull/67))
diff --git a/tox.ini b/tox.ini
index f7cb0b3..3232c2e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -34,3 +34,12 @@ deps =
    -r{toxinidir}/requirements.txt
    -r{toxinidir}/dev_requirements.txt
    -e.
+
+[testenv:integration-mariadb-10.5]
+basepython = python3
+commands = /bin/bash -c '{envpython} -m pytest test/integration/mariadb-10.5.dbtspec'
+passenv = DBT_INVOCATION_ENV DBT_MYSQL_SERVER_NAME
+deps =
+  -r{toxinidir}/requirements.txt
+  -r{toxinidir}/dev_requirements.txt
+  -e.


Test patch:
diff --git a/test/integration/mariadb-10.5.dbtspec b/test/integration/mariadb-10.5.dbtspec
new file mode 100644
index 0000000..00c7682
--- /dev/null
+++ b/test/integration/mariadb-10.5.dbtspec
@@ -0,0 +1,24 @@
+
+target:
+  type: mysql
+  port: 3306
+  database: dbt_test_{{ var('_dbt_random_suffix') }}
+  schema: dbt_test_{{ var('_dbt_random_suffix') }}
+  server: "{{ env_var('DBT_MYSQL_SERVER_NAME', 'localhost') }}"
+  username: "{{ env_var('DBT_MYSQL_USERNAME', 'root') }}"
+  password: "{{ env_var('DBT_MYSQL_PASSWORD', 'dbt') }}"
+
+sequences:
+
+  # List of sequences:
+  # https://github.com/fishtown-analytics/dbt-adapter-tests/tree/master/pytest_dbt_adapter/sequences
+
+  test_dbt_empty: empty
+  test_dbt_base: base
+  # test_dbt_ephemeral: ephemeral
+  test_dbt_incremental: incremental
+  # test_dbt_snapshot_strategy_timestamp: snapshot_strategy_timestamp
+  # test_dbt_snapshot_strategy_check_cols: snapshot_strategy_check_cols
+  test_dbt_data_test: data_test
+  test_dbt_schema_test: schema_test
+  # test_dbt_ephemeral_data_tests: data_test_ephemeral_models