{"id":16904352,"url":"https://github.com/naiquevin/tapestry","last_synced_at":"2025-03-22T10:31:06.729Z","repository":{"id":244551291,"uuid":"778296216","full_name":"naiquevin/tapestry","owner":"naiquevin","description":"A CLI tool for writing postgres SQL queries and pgTAP tests using Jinja templates","archived":false,"fork":false,"pushed_at":"2024-12-28T13:31:48.000Z","size":1006,"stargazers_count":25,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T10:21:28.380Z","etag":null,"topics":["pgtap","postgresql","sql"],"latest_commit_sha":null,"homepage":"https://naiquevin.github.io/tapestry/","language":"Rust","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/naiquevin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-03-27T13:07:32.000Z","updated_at":"2025-02-15T18:43:39.000Z","dependencies_parsed_at":"2024-10-28T13:15:31.101Z","dependency_job_id":"ac1d5c9e-9f7a-4dfb-bda5-d839827236cf","html_url":"https://github.com/naiquevin/tapestry","commit_stats":null,"previous_names":["naiquevin/tapestry"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naiquevin%2Ftapestry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naiquevin%2Ftapestry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naiquevin%2Ftapestry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naiquevin%2Ftapestry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naiquevin","download_url":"https://codeload.github.com/naiquevin/tapestry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244943725,"owners_count":20536290,"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":["pgtap","postgresql","sql"],"created_at":"2024-10-13T18:32:57.221Z","updated_at":"2025-03-22T10:31:06.395Z","avatar_url":"https://github.com/naiquevin.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Tapestry\n========\n\nTapestry is a framework for writing (postgres)SQL queries and\n([pgTAP](https://pgtap.org/)) tests using\n[Jinja](https://github.com/mitsuhiko/minijinja) templates. It helps\nyou write reusable SQL code and ensures that your pgTAP tests are\ntesting the exact same SQL queries that are actually run by your\napplication.\n\nTapestry is written in Rust but it can be used with applications\nwritten in any programming language. It's purely a command line tool\nthat renders Jinja templates into SQL files. How to load the resulting\nSQL code into memory and use it at runtime is entirely up to the\napplication.\n\nThis approach of loading SQL from files is not new. There are existing\nlibraries such as [yesql](https://github.com/krisajenkins/yesql),\n[hugsql](https://github.com/layerware/hugsql) (Clojure),\n[aiosql](https://github.com/nackjicholson/aiosql) (Python) etc. that\nprovide excellent abstractions for it. In absence of such a lib for\nthe language of your choice, it shouldn't take more than a few lines\nof code to implement a simple file loader. In Rust apps, I simply use\nthe `include_str!` macro.\n\nOne limitation is that `tapestry` can only be used with PostgreSQL,\nbecause of the tight coupling with `pgTAP`.\n\nYou may find this tool useful if,\n\n1. you prefer direct SQL queries over ORMs or query builders to\n   interact with RDBMS from application code\n\n2. you are not averse to the idea of having (reasonable amount of)\n   business logic inside SQL queries\n\nIn fact, if you have had concerns about point 2 i.e. having business\nlogic in SQL queries, perhaps `tapestry` addresses some of those\nconcerns. Learn more about the\n[rationale](https://naiquevin.github.io/tapestry/rationale/) behind\nthis tool.\n\nCurrent status\n--------------\n\nTapestry is a work in progress. But I am presently using it in my\npersonal project so it has been tested for the basic use cases. A\nworking [example](examples/chinook) is also included in the repo which\nyou may try out.\n\nThe first tag/version is yet to be created and released.\n\nInstallation\n------------\n\nCurrently, binaries for `x86_64` arch for Linux and MacOS can be\ndownloaded from the [Github release\npage](https://github.com/naiquevin/tapestry/releases). (Binaries for\n`arm/aarch64` platform and Windows OS are not available yet)\n\nIf you have the rust tool chain installed on your machine, you can\nbuild and install `tapestry` directly from github (without having to\nclone the repo).\n\n``` shell\ncargo install --git https://github.com/naiquevin/tapestry.git\n```\n\n### Additional dependencies\n\n`tapestry` doesn't have any additional dependencies as such, but it\ncan be optionally configured to depend on external SQL formatting\ntools. For more information, check the [SQL\nformatting](https://naiquevin.github.io/tapestry/user-guide/formatting/)\npage in docs.\n\nRead the docs\n-------------\n\nDetailed documentation about `tapestry` can be found\n[here](https://naiquevin.github.io/tapestry/)\n\nNotable sections:\n\n- [Rationale](https://naiquevin.github.io/tapestry/rationale/)\n- [Installation](https://naiquevin.github.io/tapestry/user-guide/install/)\n- [Getting started](https://naiquevin.github.io/tapestry/user-guide/getting-started/)\n- [Commands](https://naiquevin.github.io/tapestry/user-guide/commands/)\n- [SQL formatting](https://naiquevin.github.io/tapestry/user-guide/formatting/)\n- [Docker/Podman based testing workflow](https://naiquevin.github.io/tapestry/user-guide/docker/)\n\nLICENSE\n-------\n\nMIT (See [LICENSE](LICENSE)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaiquevin%2Ftapestry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaiquevin%2Ftapestry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaiquevin%2Ftapestry/lists"}