metering-operator
metering-operator copied to clipboard
Import MairaDB Data in Datasource
Hi. I want to put the value of the table in MariaDB into the Datasource. What should I do? ex)
-
MariaDB
-
table-name: table_test
timestamp | element | value |
---|---|---|
2019-03-18 01:04:00.000 | A | 12 |
2019-03-19 01:04:00.000 | A | 10 |
I want to put the data into the datasource as shown below.
- Datasource
- Datasource-name: test-mariadb-table
select * from test-mariadb-table
timestamp | element | value |
---|---|---|
2019-03-18 01:04:00.000 | A | 12 |
2019-03-19 01:04:00.000 | A | 10 |
How can I create a datasource yaml, and what api can I put data in?
Thank you
This currently isn't supported. Presto supports connecting to mysql, and we've got some upcoming work that would make this easier, but currently there isn't any support for this.
If you're interested, we define the Presto catalogs here: https://github.com/operator-framework/operator-metering/blob/master/charts/presto/templates/_helpers.tpl#L1-L17 and here: https://github.com/operator-framework/operator-metering/blob/master/charts/presto/templates/presto-catalog-config-secret.yaml with default values coming from https://github.com/operator-framework/operator-metering/blob/master/charts/presto/values.yaml
You could then configure presto to access your MySQL database using by updating the templates to configure the mysql connector based on the upstream docs: https://prestodb.github.io/docs/current/connector/mysql.html
I'd also like to mention, that upcoming work is a rewrite of how we manage tables, and will allow you to do this stuff more easily, though we would still need support for configuring presto to use mysql as a connector (relatively simple though).
I started an initial PR to make it so you can configure Presto to access other databases here https://github.com/operator-framework/operator-metering/pull/650
See the PR for details/examples.
@chancez Thank you for your feedback! https://github.com/operator-framework/operator-metering/pull/650 this is nice work!