{"id":28810135,"url":"https://github.com/covermymeds/sql_footprint","last_synced_at":"2025-07-17T06:38:19.084Z","repository":{"id":51034250,"uuid":"54175622","full_name":"covermymeds/sql_footprint","owner":"covermymeds","description":"A Ruby gem that keeps a footprint of your sql queries that you can check into source control. ","archived":false,"fork":false,"pushed_at":"2023-11-01T19:38:29.000Z","size":73,"stargazers_count":12,"open_issues_count":2,"forks_count":8,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-05-24T08:51:35.274Z","etag":null,"topics":["database","footprint","sql","usage"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/covermymeds.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-03-18T05:15:43.000Z","updated_at":"2024-08-29T16:18:39.000Z","dependencies_parsed_at":"2022-08-30T21:41:05.999Z","dependency_job_id":"1e9c7ff4-aa8f-43c6-8c90-f59877976b45","html_url":"https://github.com/covermymeds/sql_footprint","commit_stats":{"total_commits":92,"total_committers":11,"mean_commits":8.363636363636363,"dds":0.6413043478260869,"last_synced_commit":"dc07f0e4fa03c0ec84f388f622c5756312ba34bc"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/covermymeds/sql_footprint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/covermymeds%2Fsql_footprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/covermymeds%2Fsql_footprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/covermymeds%2Fsql_footprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/covermymeds%2Fsql_footprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/covermymeds","download_url":"https://codeload.github.com/covermymeds/sql_footprint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/covermymeds%2Fsql_footprint/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260563617,"owners_count":23028587,"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":["database","footprint","sql","usage"],"created_at":"2025-06-18T13:43:15.186Z","updated_at":"2025-07-17T06:38:19.077Z","avatar_url":"https://github.com/covermymeds.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SqlFootprint [![Build Status](https://travis-ci.org/covermymeds/sql_footprint.svg?branch=master)](https://travis-ci.org/covermymeds/sql_footprint)\n\nThis gem allows you to keep a \"footprint\" of the sql queries that your application runs.\nIt's like logging all the sql you're executing except that we remove all the value parameters\nand dedupe similar queries. This footprint should be valuable in determining if changes you've\nmade will significantly change the way you're querying the database.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'sql_footprint', group: [:development, :test]\n```\n\nAnd then execute:\n\n    $ bundle\n\n## Usage\n\nTypically, you would want to run this while you're running your specs.\nFor example w/ RSpec:\n```ruby\nRSpec.configure do |config|\n  config.before(:suite) { SqlFootprint.start }\n  config.after(:suite) { SqlFootprint.stop }\nend\n```\n\nMinitest (in `test_helper.rb`) add the following:\n```ruby\nSqlFootprint.start\nMinitest.after_run { SqlFootprint.stop }\n```\n\nYou can also add a Custom rule to SqlAnonymizer before running `start`:\n```ruby\nRSpec.configure do |config|\n  SqlFootprint::SqlAnonymizer.add_rule(/SELECT (.+) AS (.+)/, 'SELECT [redacted] AS [redacted]')\n  config.before(:suite) { SqlFootprint.start }\n  config.after(:suite) { SqlFootprint.stop }\nend\n```\n\n#### Outputs\nAfter running your specs you'll find a 'footprint.*.sql' file in your project.\nFootprints are per-database. For example, if you're using DB1 AND DB2 in your app, you would end up with two footprint files. (footprint.db1.sql, footprint.db2.sql)\n\nIf you're using an in-memory database, you'll end up with `footprint.:memory:.sql`.\n\n#### Excluding Setup Code\n\nIf you want to exclude queries that your tests generate for fixture data, you can use the ```.exclude``` method.  For example:\n```ruby\nbefore do\n  SqlFootprint.exclude do\n    Model.create!(args*) # this query will not be included in your footprint\n  end\nend\n```\n\nOr if you're using FactoryBot you could do something like this:\n```ruby\nRSpec.configure do |config|\n  module FactoryKid\n    def create(*args)\n      SqlFootprint.exclude { FactoryBot.create(*args) }\n    end\n  end\n  config.include FactoryKid\nend\n```\n\n## Compatibility\n- For Rails \u003c 6.0 compatibility, please use v2.0.1.\n- For Rails \u003e= 6.0 compatibility, please use v3.0.0.\n- For Rails \u003e= 7.0, please use v3.0.1\n\nDO NOT run SqlFootprint in production!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcovermymeds%2Fsql_footprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcovermymeds%2Fsql_footprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcovermymeds%2Fsql_footprint/lists"}