Create a MySQL Data Source
Disclaimer - Beta Feature
Support for MySQL data sources is an opt-in beta feature that needs to be turned on manually, see Enable Feature Flag.
Do not use beta features in your production environment.
Follow these steps to connect to MySQL and create a MySQL data source:
Refer to Additional Information for additional performance tips and information about MySQL feature support.
Enable Feature Flag
In GoodData Cloud Native, MySQL data source is an opt-in feature. If you want to try to connect to a MySQL data source, you first have to enable this feature in your Kubernetes deployment.
Steps:
Create a
mysql-ff.yaml
file containing the following values:authService: extraEnvVars: - name: GDC_FEATURES_VALUES_ENABLE_MYSQL_DATA_SOURCE value: "true" metadataApi: extraEnvVars: - name: GDC_FEATURES_VALUES_ENABLE_MYSQL_DATA_SOURCE value: "true"
Upgrade your helm chart using the yaml file:
helm upgrade -n gooddata-cn gooddata-cn gooddata/gooddata-cn \ --values customized-values-gooddata-cn.yaml \ --values mysql-ff.yaml
see the K8S Upgrade Guide if you need a more detailed explanation of this statement.
Be Careful When Updating Helm Chart
Unlike YAML objects, arrays are NOT mergeable. If you are updating the helm chart using multiple yaml files, you risk overwriting your
extraEnvVars
values from one YAML file, byextraEnvVars
from your other YAML file. For this reason we recommend you stage all your changes to arrays likeextraEnvVars
in a single YAML file.
Please note that you will have to include the mysql-ff.yaml
file in all your future helm upgrades, if you want to keep this feature flag enabled.
If you want to enable this feature flag permanently, we recommend you update authService
and metadataApi
in the customized-values-gooddata-cn.yaml
file itself. However our current plan is to enable this feature by default, once it is out of beta.
Configure User Access Rights
We recommend that you create a dedicated user and user role for integration with the GoodData platform.
Steps:
Create a user role and grant access rights:
CREATE ROLE {role_name}; GRANT SELECT ON {database_name}.* TO {role_name};
Note that pre-aggregation caching is not currently supported for MySQL data sources.
Create a user and grant it the user role:
CREATE USER {user_name}; GRANT {role_name} TO {user_name};
Make the user role default for the user:
ALTER USER {user_name} DEFAULT ROLE {role_name};
Create a MySQL Data Source
Once you have configured your MySQL user’s access rights, you can proceed to create a MySQL data source that you can then connect to.
Steps:
On the home page switch to Data sources.
Click Connect data.
Select MySQL.
Name your data source and fill in your MySQL credentials and click Connect:
Click Save.
Your data source is created!
Steps:
Create a MySQL data source with the following API call:
curl $HOST_URL/api/v1/entities/dataSources \ -H "Content-Type: application/vnd.gooddata.api+json" \ -H "Accept: application/vnd.gooddata.api+json" \ -H "Authorization: Bearer $API_TOKEN" \ -X POST \ -d '{ "data": { "type": "dataSource", "id": "<unique_id_for_the_data_source>", "attributes": { "name": "<data_source_display_name>", "url": "jdbc:mysql:https://<MYSQL_HOST>:8443/<MYSQL_DBNAME>", "schema": "<MYSQL_DBNAME>", "type": "MYSQL", "username": "<MYSQL_USER>", "password": "<MYSQL_PASSWORD>" }}}' | jq .
To confirm that the data source has been created, ensure the server returns the following response:
{ "data": { "type": "dataSource", "id": "<unique_id_for_the_data_source>", "attributes": { "name": "<data_source_display_name>", "url": "jdbc:mysql:https://<MYSQL_HOST>:8443/<MYSQL_DBNAME>", "schema": "<MYSQL_DBNAME>", "type": "MYSQL", "username": "<MYSQL_USER>" } }, "links": { "self": "$HOST_URL/api/v1/entities/dataSources/<unique_id_for_the_data_source>" } }
Additional Information
Ensure you understand the following limitations and recommended practice.
Data Source Details
Typical JDBC URL may look like this:
jdbc:mysql:https://<host>:<port>/<databaseName>
For secured connection using SSL include
?sslMode=required
.Basic authentication is supported. Specify
user
andpassword
.GoodData uses up-to-date drivers.
Unsupported Features and Beta Limitations
GoodData does not support the following features:
- Table names must not include an uppercase letter, or they will not be scanned in the LDM modeler. This is a known bug.
- There are known issues when using SQL datasets with a MySQL database:
- Converting a regular dataset into a SQL dataset generates an invalid query. You have to manually rewrite it to make it work.
- SQL datasets are not supported if the query contains one of these data types: MEDIUM INT, TINY TEXT, MEDIUM TEXT or LONG TEXT.
- Filtering by boolean columns is not supported
- The following functions are not supported:
- MEDIAN
- PERCENTILE
- CORREL
- COVAR
- RSQ
- SLOPE
- INTERCEPT
- We do not currently support multiple hosts for MySQL JDBC URLs.
We plan to implement support for most of these features by the end of the beta process.