Details
-
Bug
-
Status: In Review (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.6
-
None
-
Focal, mariadb:latest tag
Description
When using the query for REST API (note you need to have curl installed:
MariaDB [test]> create table cusers3 engine=connect http='http://jsonplaceholder.typicode.com/users' table_type=json; |
The result is:
- when used locally (VM Ubuntu Focal, MariaDB 10.6) , the result is:
Query OK, 0 rows affected, 1 warning (0.140 sec)MariaDB [test]> show grants for current_user;
+-----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for anel@localhost |
+-----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `anel`@`localhost` IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket WITH GRANT OPTION |
+-----------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)
Â
MariaDB [test]> show create table cusers3\G
*************************** 1. row ***************************
Table: cusers3
Create Table: CREATE TABLE `cusers3` (
`id` int(2) NOT NULL `JPATH`='$.id',
`name` char(24) NOT NULL `JPATH`='$.name',
`username` char(16) NOT NULL `JPATH`='$.username',
`email` char(25) NOT NULL `JPATH`='$.email',
`address_street` char(17) NOT NULL `JPATH`='$.address.street',
`address_suite` char(9) NOT NULL `JPATH`='$.address.suite',
`address_city` char(14) NOT NULL `JPATH`='$.address.city',
`address_zipcode` char(10) NOT NULL `JPATH`='$.address.zipcode',
`address_geo_lat` char(8) NOT NULL `JPATH`='$.address.geo.lat',
`address_geo_lng` char(9) NOT NULL `JPATH`='$.address.geo.lng',
`phone` char(21) NOT NULL `JPATH`='$.phone',
`website` char(13) NOT NULL `JPATH`='$.website',
`company_name` char(18) NOT NULL `JPATH`='$.company.name',
`company_catchPhrase` char(40) NOT NULL `JPATH`='$.company.catchPhrase',
`company_bs` char(36) NOT NULL `JPATH`='$.company.bs'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='json' `HTTP`='http://jsonplaceholder.typicode.com/users'
1 row in set (0.000 sec)
- in Docker is an error
MariaDB [web_users]> create table cusers3 engine=connect http='http://jsonplaceholder.typicode.com/users' table_type=json;
ERROR 1105 (HY000): Can only retrieve columns from object rows
Â
MariaDB [web_users]> select current_user;
+----------------+
| current_user |
+----------------+
| root@localhost |
+----------------+
Â
MariaDB [web_users]> show grants for current_user;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED BY PASSWORD '*EC427DF1E97E95DCB88D86BEDFE9AF58AE7D3563' WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------+
The first thing CONNECT is doing is to create the file (in above example cusers.json, and from it is doing table discovery.
In Docker file is created in data directory - /var/lib/mysql/web_users , directory that has file permissions of mysql:mysql.
My testing involved different tests regarding curl versions (Ubuntu bionic default 7.58 and Focal default 7.68), hoping to get different types of files, but no, it is not curl related.
I tested locally on Focal VM and it works, so my conclusion is that has something to do with Docker permissions. - Docker container is started with:
docker run -d -e MARIADB_USER=anel \
-e MARIADB_PASSWORD=anel -e MARIADB_DATABASE=web_users \
-e MARIADB_RANDOM_ROOT_PASSWORD=1 \
-e MARIADB_ROOT_HOST=mariadb_server1 \
-v $PWD/my_container_files:/etc/mysql/conf.d \
--name mariadb-server1 \
mariadb:latest
where the config file in my_container_files/ dir is:
printf "[mariadb]\nplugin-load-add=ha_connect\nplugin_dir=/usr/lib/mysql/plugin\n" >my_container.conf
Haven't tested in other images but expecting to have the same behavior.
Attachments
Issue Links
- relates to
-
MDBF-644 install libcurl on amd64-builder
- Closed
-
MDEV-30432 Refactor connect to use libcurl instead of cpprestsdk/curl
- In Review