{"id":17749864,"url":"https://github.com/mat3e/trino-demo","last_synced_at":"2026-07-09T21:31:17.654Z","repository":{"id":84498707,"uuid":"350500977","full_name":"mat3e/trino-demo","owner":"mat3e","description":"JDBC communication with Trino consuming MySQL, Mongo \u0026 Google Sheets","archived":false,"fork":false,"pushed_at":"2021-03-22T22:16:57.000Z","size":90,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T07:38:53.827Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mat3e.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-22T21:57:12.000Z","updated_at":"2024-04-14T07:38:53.828Z","dependencies_parsed_at":null,"dependency_job_id":"a6850ceb-42df-441d-9831-a5b1e7bf7199","html_url":"https://github.com/mat3e/trino-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat3e%2Ftrino-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat3e%2Ftrino-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat3e%2Ftrino-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat3e%2Ftrino-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mat3e","download_url":"https://codeload.github.com/mat3e/trino-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246604613,"owners_count":20804101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-26T11:25:16.246Z","updated_at":"2025-10-17T02:55:20.132Z","avatar_url":"https://github.com/mat3e.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Trino](https://trino.io/) is a distributed SQL engine, which reads (and writes) data directly from their sources. [My tech talk](https://github.com/mat3e/talks/tree/master/docs/sql).\n\n# Trino demo\nThis project uses Quarkus and JDBC to connect with Trino.\n\n## 1. MySQL database:\n```\ndocker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=secret mysql:5\n```\n```sql\ncreate schema todos;\n\ncreate table task_groups\n(\n  id int auto_increment primary key,\n  description varchar(100) not null,\n  done bit null\n);\n\ncreate table tasks\n(\n  id int auto_increment primary key,\n  description varchar(100) not null,\n  done bit null,\n  deadline datetime null,\n  created_on datetime null,\n  updated_on datetime null,\n  task_group_id int null,\n  assigned_user int null,\n  constraint tasks_ibfk_1 foreign key (task_group_id) references task_groups (id)\n);\n\nINSERT INTO task_groups (id, description, done) VALUES (1, 'Job tasks', false);\n\nINSERT INTO tasks (id, description, done, deadline, created_on, updated_on, task_group_id, assigned_user) VALUES (1, 'Learn Java migrations', true, null, null, null, null, 1);\nINSERT INTO tasks (id, description, done, deadline, created_on, updated_on, task_group_id, assigned_user) VALUES (2, 'Start job', false, null, '2021-03-18 16:42:00', null, 1, 3);\nINSERT INTO tasks (id, description, done, deadline, created_on, updated_on, task_group_id, assigned_user) VALUES (3, 'Question everything', true, null, '2021-03-18 16:42:00', null, 1, 2);\nINSERT INTO tasks (id, description, done, deadline, created_on, updated_on, task_group_id, assigned_user) VALUES (4, 'End job', false, null, '2021-03-18 16:42:00', null, 1, 2);\nINSERT INTO tasks (id, description, done, deadline, created_on, updated_on, task_group_id, assigned_user) VALUES (5, 'Test that', false, null, '2021-03-18 16:42:00', null, null, 1);\n```\n\n## 2. Mongo:\n```\ndocker run -d -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=secret mongo\n```\n```javascript\nuse userdb\n\ndb.users.insertOne({id: 1, login: 'admin', mail: 'admin@ad.min', roles: ['ADMIN']})\ndb.users.insertOne({id: 2, login: 'user', mail: 'user@ad.min', roles: ['USER']})\ndb.users.insertOne({id: 3, login: 'test', mail: 'test@ad.min', roles: ['USER', 'MODERATOR']})\n```\n\n## 3. Google Sheets:\n* Metadata (`tables` sheet):\n  \n  Table Name|sheetid#sheetname|Owner|Notes\n  ---|---|---|---\n  metadata_table|sheet_id#tables| |Self reference to this sheet as table\n  users|sheet_id#users| |Next sheet here\n* Users (`users` sheet):\n \n  Number|Name|Surname\n  ---|---|---\n  1|Anna|Nowak\n  2|Jan|Kowalski\n* [Enable Google Sheets API](https://console.developers.google.com/apis/library/sheets.googleapis.com)\n* Create Credentials (Service Account)\n* Create a new JSON key for account\n* Share your sheet(s) with account's e-mail\n\n## 4. Trino:\n* Download \u0026 unpack [trino-server-353.tar.gz](https://repo1.maven.org/maven2/io/trino/trino-server/353/trino-server-353.tar.gz)\n* Create `etc` directory inside the installation directory and `catalog` subdirectory in `etc`\n* `etc/node.properties`\n  ```\n  node.environment=common_for_all_the_nodes\n  node.id=consistent_but_unique_node1\n  node.data-dir=/path/to/store/logs/data\n  ```\n* `etc/jvm.config`\n  ```\n  -server\n  -Xmx16G\n  -XX:-UseBiasedLocking\n  -XX:+UseG1GC\n  -XX:G1HeapRegionSize=32M\n  -XX:+ExplicitGCInvokesConcurrent\n  -XX:+ExitOnOutOfMemoryError\n  -XX:+HeapDumpOnOutOfMemoryError\n  -XX:ReservedCodeCacheSize=512M\n  -XX:PerMethodRecompilationCutoff=10000\n  -XX:PerBytecodeRecompilationCutoff=10000\n  -Djdk.attach.allowAttachSelf=true\n  -Djdk.nio.maxCachedBufferSize=2000000\n  ```\n* `etc/config.properties`\n  ```\n  coordinator=true\n  node-scheduler.include-coordinator=true\n  http-server.http.port=9090\n  query.max-memory=5GB\n  query.max-memory-per-node=1GB\n  query.max-total-memory-per-node=2GB\n  discovery-server.enabled=true\n  discovery.uri=http://localhost:9090\n  ```\n* `etc/catalog/mysql.properties`\n  ```\n  connector.name=mysql\n  connection-url=jdbc:mysql://localhost:3306\n  connection-user=root\n  connection-password=secret\n  ```\n* `etc/catalog/mongo.properties`\n  ```\n  connector.name=mongodb\n  mongodb.seeds=localhost:27017\n  mongodb.credentials=root:secret@admin\n  ```\n* `etc/catalog/sheets.properties`\n  ```\n  connector.name=gsheets\n  credentials-path=/path/to/json/key\n  metadata-sheet-id=sheet-id-with-metadata\n  ```\n* Execute `bin/launcher run`\n\n## 5. Start the app `./mvnw compile quarkus:dev`, open `localhost:8080`\n\n### Reference:\n* [Quarkus guide](https://quarkus.io/guides/getting-started)\n* [Trino docs](https://trino.io/docs/current/index.html)\n  * [Configuring Trino](https://trino.io/docs/current/installation/deployment.html)\n  * [Configuring MySQL connector](https://trino.io/docs/current/connector/mysql.html)\n  * [Configuring Mongo connector](https://trino.io/docs/current/connector/mongodb.html)\n  * [Configuring Google Sheets connector](https://trino.io/docs/current/connector/googlesheets.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmat3e%2Ftrino-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmat3e%2Ftrino-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmat3e%2Ftrino-demo/lists"}