{"id":16312456,"url":"https://github.com/kiranandcode/petrol","last_synced_at":"2025-10-29T07:48:54.775Z","repository":{"id":65261540,"uuid":"587688899","full_name":"kiranandcode/petrol","owner":"kiranandcode","description":"Petrol's an OCaml SQL API made to go FAST.","archived":false,"fork":false,"pushed_at":"2025-10-28T15:44:08.000Z","size":380,"stargazers_count":126,"open_issues_count":7,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-28T17:35:59.708Z","etag":null,"topics":["dsl","ocaml","sql","typed-dsl"],"latest_commit_sha":null,"homepage":"https://kiranandcode.github.io/petrol/petrol/index.html","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kiranandcode.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":"2023-01-11T10:52:10.000Z","updated_at":"2025-10-28T15:44:13.000Z","dependencies_parsed_at":"2023-02-12T10:46:06.493Z","dependency_job_id":"be76c6c3-9015-4a38-8c25-26b3d6f5e4f3","html_url":"https://github.com/kiranandcode/petrol","commit_stats":{"total_commits":46,"total_committers":4,"mean_commits":11.5,"dds":"0.30434782608695654","last_synced_commit":"e83d3c833b98a3a915949651316a04469417d7f5"},"previous_names":["kiranandcode/petrol","gopiandcode/petrol"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/kiranandcode/petrol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2Fpetrol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2Fpetrol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2Fpetrol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2Fpetrol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiranandcode","download_url":"https://codeload.github.com/kiranandcode/petrol/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2Fpetrol/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281584986,"owners_count":26526171,"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-10-29T02:00:06.901Z","response_time":59,"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":["dsl","ocaml","sql","typed-dsl"],"created_at":"2024-10-10T21:48:08.280Z","updated_at":"2025-10-29T07:48:54.758Z","avatar_url":"https://github.com/kiranandcode.png","language":"OCaml","readme":"# Petrol\n\nPetrol is a Free software library that provides a high-level OCaml API\nfor interacting with SQL databases. The aim of this interface is to\nprovide a type-safe API to allow developers to define their SQL tables\nand queries directly in OCaml, thereby avoiding the impedence mismatch\nand fragility that comes with having to directly write SQL code, as is\ntypical in a normal Caqti-based project.\n\n```ocaml\nopen Petrol\nopen Petrol.Sqlite3\n\n(* define a new schema *)\nlet schema = StaticSchema.init ()\n\n(* declare a table *)\nlet example_table, Expr.[name; age] =\n    StaticSchema.declare_table schema ~name:\"example\"\n    Schema.[\n        field \"name\" ~ty:Type.text;\n        field \"age\" ~ty:Type.int\n    ]\n```\n\nPetrol's DSL allows you to express complex SQL queries as simple OCaml\nfunction compositions:\n\n```ocaml\nopen Petrol.Sqlite3\n\n(* create a query *)\nlet insert_person ~name:n ~age:a db =\n    Query.insert ~table:example_table\n        ~values:Expr.[\n            name := s n;\n            age := i a\n         ]\n    |\u003e Request.make_zero\n    |\u003e Petrol.exec db\n```\n\n\nSee the rest of the documentation at [here](https://kiranandcode.github.io/petrol/petrol/index.html).\n","funding_links":[],"categories":["\u003ca name=\"OCaml\"\u003e\u003c/a\u003eOCaml"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiranandcode%2Fpetrol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiranandcode%2Fpetrol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiranandcode%2Fpetrol/lists"}