{"id":50803744,"url":"https://github.com/dumblepy/nim-allographer","last_synced_at":"2026-06-12T23:01:33.065Z","repository":{"id":35397646,"uuid":"211533823","full_name":"dumblepy/nim-allographer","owner":"dumblepy","description":"A query_builder/ORM library inspired by Laravel/PHP and Orator/Python for Nim","archived":false,"fork":false,"pushed_at":"2026-04-04T16:14:26.000Z","size":4464,"stargazers_count":169,"open_issues_count":15,"forks_count":11,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-06-12T06:31:49.081Z","etag":null,"topics":["database","mariadb","mysql","nim","nim-lang","orm","postgresql","query-builder","rdb","sqlite3","surrealdb"],"latest_commit_sha":null,"homepage":"","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dumblepy.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2019-09-28T17:02:16.000Z","updated_at":"2026-05-12T22:02:46.000Z","dependencies_parsed_at":"2023-01-15T20:07:05.008Z","dependency_job_id":"f40234d8-21f2-4d98-a77c-f45917f236e8","html_url":"https://github.com/dumblepy/nim-allographer","commit_stats":null,"previous_names":["dumblepy/nim-allographer"],"tags_count":53,"template":false,"template_full_name":null,"purl":"pkg:github/dumblepy/nim-allographer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumblepy%2Fnim-allographer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumblepy%2Fnim-allographer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumblepy%2Fnim-allographer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumblepy%2Fnim-allographer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dumblepy","download_url":"https://codeload.github.com/dumblepy/nim-allographer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumblepy%2Fnim-allographer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34265491,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"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":["database","mariadb","mysql","nim","nim-lang","orm","postgresql","query-builder","rdb","sqlite3","surrealdb"],"created_at":"2026-06-12T23:01:27.409Z","updated_at":"2026-06-12T23:01:28.457Z","avatar_url":"https://github.com/dumblepy.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"allographer\n===\n\n[![nimble](https://raw.githubusercontent.com/yglukhov/nimble-tag/master/nimble.png)](https://github.com/yglukhov/nimble-tag)  \n![Build Status](https://github.com/itsumura-h/nim-allographer/workflows/Build%20and%20test%20Nim/badge.svg)\n\n\nAn asynchronous query builder library inspired by [Laravel/PHP](https://readouble.com/laravel/6.0/en/queries.html) and [Orator/Python](https://orator-orm.com) for Nim.  \nSupported Databases are [Sqlite3](https://www.sqlite.org/index.html), [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/) and [MariaDB](https://mariadb.org/). (SurrealDB is planned to be supported in v3)  \nSupported Nim v2\n\n## Easy to access Rdb\n### Query Builder\n```nim\nimport asyncdispatch, json\nimport allographer/connection\nimport allographer/query_builder\n\nlet maxConnections = 95\nlet timeout = 30\nlet rdb = dbOpen(PostgreSQL, \"database\", \"user\", \"password\", \"localhost\", 5432, maxConnections, timeout)\n# also available\n# let rdb = dbOpen(SQLite3, \"/path/to/db/sqlite3.db\", maxConnections=maxConnections, timeout=timeout)\n# let rdb = dbOpen(MySQL, \"database\", \"user\", \"password\", \"localhost\", 3306, maxConnections, timeout)\n# let rdb = dbOpen(MariaDB, \"database\", \"user\", \"password\", \"localhost\", 3306, maxConnections, timeout)\n# let rdb = dbOpen(PostgreSQL, databaseUrl = asDatabaseUrl(\"postgresql://user:password@localhost:5432/database\"), maxConnections=maxConnections, timeout=timeout)\n# let surreal = dbOpen(SurrealDB, \"test_ns\" \"test_db\", \"user\", \"password\" \"http://localhost\", 8000, maxConnections, timeout)\n\nproc main(){.async.} =\n  let result = await rdb\n                    .table(\"users\")\n                    .select(\"id\", \"email\", \"name\")\n                    .limit(5)\n                    .offset(10)\n                    .get()\n  echo result\n\nwaitFor main()\n\n\u003e\u003e SELECT id, email, name FROM users LIMIT 5 OFFSET 10\n\u003e\u003e @[\n  {\"id\":11,\"email\":\"user11@gmail.com\",\"name\":\"user11\"},\n  {\"id\":12,\"email\":\"user12@gmail.com\",\"name\":\"user12\"},\n  {\"id\":13,\"email\":\"user13@gmail.com\",\"name\":\"user13\"},\n  {\"id\":14,\"email\":\"user14@gmail.com\",\"name\":\"user14\"},\n  {\"id\":15,\"email\":\"user15@gmail.com\",\"name\":\"user15\"}\n]\n```\n\n### Schema Builder\n```nim\nimport allographer/schema_builder\n\n\nrdb.create([\n  table(\"auth\", [\n    Column.increments(\"id\"),\n    Column.string(\"name\").nullable(),\n    Column.timestamp(\"created_at\").default()\n  ]),\n  table(\"users\", [\n    Column.increments(\"id\"),\n    Column.string(\"name\"),\n    Column.foreign(\"auth_id\").reference(\"id\").on(\"auth\").onDelete(SET_NULL)\n  ])\n])\n\n\u003e\u003e CREATE TABLE auth (\n    id INT NOT NULL PRIMARY KEY,\n    name VARCHAR,\n    created_at DATETIME DEFAULT (NOW())\n)\n\u003e\u003e CREATE TABLE users (\n    id INT NOT NULL PRIMARY KEY,\n    name VARCHAR NOT NULL,\n    auth_id INT,\n    FOREIGN KEY(auth_id) REFERENCES auth(id) ON DELETE SET NULL\n)\n\nrdb.alter(\n  table(\"users\", [\n    Column.string(\"email\").unique().default(\"\").add(),\n    Column.deleteColumn(\"name\")\n  ])\n)\n\n\u003e\u003e ALTER TABLE \"users\" ADD COLUMN 'email' VARCHAR UNIQUE DEFAULT '' CHECK (length(\"email\") \u003c= 255)\n\u003e\u003e ALTER TABLE \"users\" DROP `name`\n```\n\n## Index\n\u003c!--ts--\u003e\n- [allographer](#allographer)\n  - [Easy to access Rdb](#easy-to-access-rdb)\n    - [Query Builder](#query-builder)\n    - [Schema Builder](#schema-builder)\n  - [Index](#index)\n  - [Install](#install)\n  - [Configuation](#configuation)\n  - [Createing connection](#createing-connection)\n  - [Logging](#logging)\n  - [Documents](#documents)\n  - [Nim API Documents](#nim-api-documents)\n    - [v2](#v2)\n  - [Development](#development)\n    - [Branch naming rule](#branch-naming-rule)\n\n\u003c!-- Created by https://github.com/ekalinin/github-markdown-toc --\u003e\n\u003c!-- Added by: root, at: Mon Jul 17 07:46:10 UTC 2023 --\u003e\n\n\u003c!--te--\u003e\n---\n\n## Install\n```sh\nnimble install allographer\n```\n\nIf you get `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` when trying to use the database you likely have a problem with the library path. On OS X the default is to check for the `brew --prefix` of the chosen driver, if that doesn't work it will look in `/usr/lib` or an environment variable `DYLD_xxx_PATH` where `xxx` if your driver: `SQLITE`, `MARIADB`, `MYSQL` or `POSTGRES`.\n\n## Configuation\nAllographer loads emvironment variables of `DB_SQLITE`, `DB_POSTGRES`, `DB_MYSQL` and `DB_MARIADB` to define which process should be **compiled**.\u003cbr\u003e\n(`DB_SURREAL` is planned to be supported in v3)\u003cbr\u003e\nThese environment variables have to be set at compile time, so they have to be written in `config.nims` not in `.env`.\n\nconfig.nims\n```nim\nimport os\n\nputEnv(\"DB_SQLITE\", $true)\nputEnv(\"DB_POSTGRES\", $true)\n```\nIn this example, even if your runtime environment lacks `mysqlclient-dev`, execution will success. However if your runtime environment lacks `sqlite3`, execution will fail.\n\n## Createing connection\nDatabase connection should be definded as singleton variable.\n\ndatabase.nim\n```nim\nimport allographer/connection\n\nlet rdb* = dbOpen(PostgreSQL, \"database\", \"user\", \"password\", \"localhost\", 5432, maxConnections, timeout)\n\n# you can create connection for multiple database at same time.\nlet sqliteRdb* = dbOpen(Sqlite3, \"/path/to/db/sqlite3.db\", maxConnections=maxConnections, timeout=timeout)\nlet mysqlRdb* = dbOpen(MySQL, \"database\", \"user\", \"password\", \"localhost\", 3306, maxConnections, timeout)\nlet mariaRdb* = dbOpen(MariaDB, \"database\", \"user\", \"password\", \"localhost\", 3306, maxConnections, timeout)\nlet pgUrlRdb* = dbOpen(PostgreSQL, databaseUrl = asDatabaseUrl(\"postgresql://user:password@localhost:5432/database\"), maxConnections=maxConnections, timeout=timeout)\n# let surrealDb* = dbOpen(SurrealDb, \"test_ns\" \"test_db\", \"user\", \"password\" \"http://localhost\", 8000, maxConnections, timeout) # planned for v3\n```\n\nThen, call connection when you run query.\n\nrun_sql.nim\n```nim\nimport asyncdispatch\nimport allographer/query_builder\nfrom database import rdb\n\nproc main(){.async.}=\n  echo await rdb.table(\"users\").get()\n\nwaitFor main()\n```\n\n## Logging\nPlease set args in `dbOpen()`\n```nim\nproc dbOpen*(driver:Driver, database:string=\"\", user:string=\"\", password:string=\"\",\n            host: string=\"\", port=0, maxConnections=1, timeout=30,\n            shouldDisplayLog=false, shouldOutputLogFile=false, logDir=\"\"):Rdb\n```\n- shouldDisplayLog: Whether display logging in terminal console or not.\n- shouldOutputLogFile: Whether output logging in log file or not.\n- logDir: Define logging dir path.\n\n\n## Documents\n[Schema Builder for RDB](./documents/rdb/schema_builder.md)  \n[Query Builder for RDB](./documents/rdb/query_builder.md)  \n[Schema Builder for SurrealDB](./documents/surrealdb/schema_builder.md) (planned for v3)  \n[Query Builder for SurrealDB](./documents/surrealdb/query_builder.md) (planned for v3)\n\n\n## Nim API Documents\n### v2\n[connection](https://itsumura-h.github.io/nim-allographer/v2/connection.html)  \n[Schema Builder](https://itsumura-h.github.io/nim-allographer/v2/schema_builder.html)  \n[Query Builder](https://itsumura-h.github.io/nim-allographer/v2/query_builder.html)\n\n\n## Development\n### Branch naming rule\nPlease create this branch name when you will create a new pull request.\n\n| Branch | Description |\n| ------ | ----------- |\n| feature-*** | New feature branch |\n| hotfix-*** | Bug fix branch |\n| chore-*** | Chore work or maintenance |\n\nThis naming rule automatically labels the pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdumblepy%2Fnim-allographer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdumblepy%2Fnim-allographer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdumblepy%2Fnim-allographer/lists"}