{"id":16795598,"url":"https://github.com/nineinchnick/trino-git","last_synced_at":"2025-03-17T03:30:59.811Z","repository":{"id":37928319,"uuid":"325813844","full_name":"nineinchnick/trino-git","owner":"nineinchnick","description":"A Trino connector to access git repository contents","archived":false,"fork":false,"pushed_at":"2025-03-10T17:27:59.000Z","size":450,"stargazers_count":17,"open_issues_count":12,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-15T06:48:31.333Z","etag":null,"topics":["git","hacktoberfest","sql","trino-plugin"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nineinchnick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-12-31T14:15:35.000Z","updated_at":"2025-03-06T11:22:47.000Z","dependencies_parsed_at":"2023-02-13T00:46:38.522Z","dependency_job_id":"96fa7635-4f9b-44d2-a225-42d430da1e2a","html_url":"https://github.com/nineinchnick/trino-git","commit_stats":null,"previous_names":[],"tags_count":91,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nineinchnick%2Ftrino-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nineinchnick%2Ftrino-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nineinchnick%2Ftrino-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nineinchnick%2Ftrino-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nineinchnick","download_url":"https://codeload.github.com/nineinchnick/trino-git/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243841204,"owners_count":20356441,"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":["git","hacktoberfest","sql","trino-plugin"],"created_at":"2024-10-13T09:16:50.739Z","updated_at":"2025-03-17T03:30:59.375Z","avatar_url":"https://github.com/nineinchnick.png","language":"Java","readme":"Trino git Connector\n===================\n\n[![Build Status](https://github.com/nineinchnick/trino-git/actions/workflows/release.yaml/badge.svg)](https://github.com/nineinchnick/trino-git/actions/workflows/release.yaml)\n\nThis is a [Trino](http://trino.io/) connector to access git repos. Please keep in mind that this is not production ready and it was created for tests.\n\n# Quick Start\n\nTo run a Docker container with the connector, run the following:\n```bash\ndocker run \\\n  -d \\\n  --name trino-git \\\n  -e REPO_URL=https://github.com/nineinchnick/trino-rest.git \\\n  -p 8080:8080 \\\n  nineinchnick/trino-git:0.87\n```\n\nThen use your favourite SQL client to connect to Trino running at http://localhost:8080\n\n# Usage\n\nDownload one of the ZIP packages, unzip it and copy the `trino-git-0.87` directory to the plugin directory on every node in your Trino cluster.\nCreate a `github.properties` file in your Trino catalog directory and point to a remote repo.\nYou can also use a path to a local repo if it's available on every worker node.\n\n```\nconnector.name=git\nmetadata-uri=https://github.com/nineinchnick/trino-git.git\n```\n\nAfter reloading Trino, you should be able to connect to the `git` catalog and see the following tables in the `default` schema:\n* `branches`\n* `commits` - all commits from every branch, with author, committer, message and commit time\n* `diff_stats` - any files modified, deleted or renamed in every commit, with number of added and/or deleted lines\n* `objects` - every file contents\n* `tags`\n* `trees` - all files in every commit, with file mode and attributes\n\nTo see who has commits with only deleted lines:\n\n```sql\nSELECT\n    i.name,\n    i.email,\n    min(c.commit_time) FILTER (WHERE c.added_lines = 0 AND c.deleted_lines != 0) AS first_delete_only_commit_at,\n    count(*) FILTER (WHERE c.added_lines = 0 AND c.deleted_lines != 0) AS delete_only_commit_count,\n    CAST(count(*) FILTER (WHERE c.added_lines = 0 AND c.deleted_lines != 0) AS double) / CAST(COUNT(*) AS double) AS delete_only_commit_ratio\nFROM\n    commit_stats c\nJOIN idents i ON\n    c.author_email = i.email OR CONTAINS(i.extra_emails, c.author_email)\nGROUP BY\n    i.name,\n    i.email\nHAVING\n    count(*) FILTER (WHERE c.added_lines = 0 AND c.deleted_lines != 0) != 0\nORDER BY\n    i.name,\n    i.email;\n```\n\nShould return:\n```\nname   |email         |first_delete_only_commit_at|delete_only_commit_count|delete_only_commit_ratio|\n-------|--------------|---------------------------|------------------------|------------------------|\nJan Was|jan@was.net.pl|        2021-01-09 23:22:28|                       2|     0.08695652173913043|\n```\n\n# Build\n\nRun all the unit test classes.\n```\nmvn test\n```\n\nCreates a deployable jar file\n```\nmvn clean compile package\n```\n\nCopy jar files in target directory to use git connector in your Trino cluster.\n```\ncp -p target/*.jar ${PLUGIN_DIRECTORY}/git/\n```\n\n# Deploy\n\nAn example command to run the Trino server with the git plugin and catalog enabled:\n\n```bash\nsrc=$(git rev-parse --show-toplevel)\ndocker run \\\n  -v $src/target/trino-git-0.70-SNAPSHOT:/usr/lib/trino/plugin/git \\\n  -v $src/catalog:/usr/lib/trino/default/etc/catalog \\\n  -p 8080:8080 \\\n  --name trino \\\n  -d \\\n  trinodb/trino:462\n```\n\nConnect to that server using:\n```bash\ndocker run -it --rm --link trino trinodb/trino:462 trino --server trino:8080 --catalog git --schema default\n```\n\n# References\n\nIf you're looking to analize the structure or contents of a Git repo, [gitbase](https://github.com/src-d/gitbase) could be more suitable for such task.\nIt could even work with Trino, since Trino has a [MySQL connector](https://trino.io/docs/current/connector/mysql.html).\n\nIf you also want to analyze Github issues, pull requests (with review comments) or workflow runs and jobs,\ncheck out the Github connector in [trino-rest](https://github.com/nineinchnick/trino-rest).\n\nThis effort is inspired by [Acha](https://github.com/someteam/acha), to be able to calculate achievements based on contents of a Git repository using SQL.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnineinchnick%2Ftrino-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnineinchnick%2Ftrino-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnineinchnick%2Ftrino-git/lists"}