{"id":14860784,"url":"https://github.com/sake92/squery","last_synced_at":"2025-08-14T05:06:16.981Z","repository":{"id":177836486,"uuid":"604118745","full_name":"sake92/squery","owner":"sake92","description":"Simple SQL queries in Scala 3","archived":false,"fork":false,"pushed_at":"2025-07-14T18:12:54.000Z","size":982,"stargazers_count":19,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-14T23:15:06.238Z","etag":null,"topics":["h2-database","jdbc","mysql","oracle-db","postgresql","scala","scala3","sql","sql-library"],"latest_commit_sha":null,"homepage":"https://sake92.github.io/squery","language":"Scala","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/sake92.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":["sake92"],"ko_fi":"sake92"}},"created_at":"2023-02-20T11:25:29.000Z","updated_at":"2025-07-14T18:12:58.000Z","dependencies_parsed_at":"2024-01-16T14:16:46.259Z","dependency_job_id":"2a471f35-7f77-4eb3-8362-394cf49029dd","html_url":"https://github.com/sake92/squery","commit_stats":null,"previous_names":["sake92/squery"],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/sake92/squery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sake92%2Fsquery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sake92%2Fsquery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sake92%2Fsquery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sake92%2Fsquery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sake92","download_url":"https://codeload.github.com/sake92/squery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sake92%2Fsquery/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270364971,"owners_count":24571423,"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","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["h2-database","jdbc","mysql","oracle-db","postgresql","scala","scala3","sql","sql-library"],"created_at":"2024-09-19T20:01:05.581Z","updated_at":"2025-08-14T05:06:16.961Z","avatar_url":"https://github.com/sake92.png","language":"Scala","readme":"# squery\n\nSimple SQL queries in Scala 3.\n\nNo DSLs, no fuss, just plain SQL.\n\nSupports *any* JDBC driver.  \nAdditional support for Postgres, MySql, MariaDb, Oracle, H2.\n\nScastie example: https://scastie.scala-lang.org/JArud6GGSLOmYyxCNsNdNw\n\n\n\u003e See also https://github.com/sake92/mill-squery for generating boilerplate models and DAOs automatically from db.\n\n## Hello world:\n```scala\n\n// table rows\ncase class Customer(id: Int, name: String) derives SqlReadRow\ncase class Phone(id: Int, number: String) derives SqlReadRow\n\n// joined row\ncase class CustomerWithPhone(c: Customer, p: Phone) derives SqlReadRow\n\nval ds = JdbcDataSource()\nds.setURL(\"jdbc:h2:mem:\")\n\nval ctx = SqueryContext(ds)\n\nctx.run {\n  val res: Seq[CustomerWithPhone] = sql\"\"\"\n    SELECT c.id, c.name,\n           p.id, p.number\n    FROM customers c\n    JOIN phones p ON p.customer_id = c.id\n  \"\"\".readRows[CustomerWithPhone]()\n}\n```\n\n---\n\n## Generator\n\nYou can generate boilerplate code for `Row`s and `DAO`s.\n\n### Mill plugin\n\nSee https://github.com/sake92/mill-squery\n\n### CLI\n\nYou can use `squery-cli` with Coursier launcher to generate your sources:\n\n```shell\ncs launch ba.sake::squery-cli:0.8.1 -M ba.sake.squery.cli.SqueryMain -- \\\n  --jdbcUrl jdbc:h2:... \\\n  --baseFolder src \\\n  --schemaMappings public:com.example.public \\\n  --schemaMappings myschema:com.example.myschema \\ # this is a repeatable argument\n  # these are optional:\n  -- colNameIdentifierMapper camelcase \\ # or noop\n  -- typeNameMapper camelcase \\ # or noop\n  -- rowTypeSuffix Row \\\n  -- daoTypeSuffix Dao \n```\n\n\n### Code\n\nYou can use `squery-generator` library to generate code directly.  \nThis is handy when using Ammonite to explore a database structure and its contents.  \nIt can also be used to generate source code manually in scala-cli or in your project (if you dont like CLI or mill plugin).\n","funding_links":["https://github.com/sponsors/sake92","https://ko-fi.com/sake92"],"categories":["Table of Contents"],"sub_categories":["Database"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsake92%2Fsquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsake92%2Fsquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsake92%2Fsquery/lists"}