{"id":26316848,"url":"https://github.com/nathanthorell/dataspy","last_synced_at":"2025-07-18T11:35:11.278Z","repository":{"id":275217526,"uuid":"717932757","full_name":"nathanthorell/dataspy","owner":"nathanthorell","description":"dataspy is a lightweight database monitoring tool that quietly observes your databases for business rule violations.","archived":false,"fork":false,"pushed_at":"2025-03-27T00:37:40.000Z","size":29,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T01:31:02.294Z","etag":null,"topics":["go","postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":"Go","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/nathanthorell.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-11-13T02:01:20.000Z","updated_at":"2025-03-27T00:37:43.000Z","dependencies_parsed_at":"2025-03-27T01:26:08.327Z","dependency_job_id":"2b25bf6e-f2ad-44ed-afc1-afa06e7fb65c","html_url":"https://github.com/nathanthorell/dataspy","commit_stats":null,"previous_names":["nathanthorell/dataspy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nathanthorell/dataspy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanthorell%2Fdataspy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanthorell%2Fdataspy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanthorell%2Fdataspy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanthorell%2Fdataspy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nathanthorell","download_url":"https://codeload.github.com/nathanthorell/dataspy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanthorell%2Fdataspy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265751401,"owners_count":23822759,"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":["go","postgresql","sql"],"created_at":"2025-03-15T13:16:59.163Z","updated_at":"2025-07-18T11:35:07.750Z","avatar_url":"https://github.com/nathanthorell.png","language":"Go","readme":"# dataspy\n\ndataspy is a lightweight database monitoring tool that quietly observes your databases for business rule violations. It supports running SQL-based rules against multiple database types and can schedule regular checks.\n\n## Features\n\n- **Multi-Database Support**: Currently supports PostgreSQL, MySQL, and SQL Server\n- **Configurable Rules**: Define SQL queries to check for business rule violations\n- **Scheduled Monitoring**: Run rules on configurable cron schedules\n- **Environment-Based Configuration**: Secure connection string management via environment variables\n- **Cross-Database Monitoring**: Run the same business rules against multiple databases or environments\n\n## Configuration\n\n### Project Structure\n\n```none\n├── /\n│── main.go              # Application entry point\n├── config/              # Configuration management\n│   └── config.toml      # Application configuration\n├── db/                  # Database interaction\n├── runner/              # Task scheduling and execution\n└── Dockerfile           # Container build instructions\n```\n\n### Environment Setup\n\nCreate a `.env` file in your project directory with your database connection strings:\n\n```env\nPG_DBCONN=\"host=localhost port=5432 user=postgres password=secret dbname=postgres sslmode=disable\"\nMSSQL_DBCONN=\"server=localhost;user id=sa;password=secret;port=1433;database=master\"\nMySQL_DBCONN=\"root:secret@tcp(localhost:3306)/mysql\"\n```\n\n### Application Configuration\n\nConfiguration is managed through a single TOML file (`config.toml`) with three main sections:\n\n1. **Database Servers**\n\n    ```toml\n    [[db_servers]]\n    Name = \"Local Postgres\"\n    Type = \"postgres\"\n    ConnStringVar = \"PG_DBCONN\"\n    ```\n\n1. **Rules**\n\n    ```toml\n    [[rules]]\n    Name = \"Check Data Consistency\"\n    Description = \"Verify data integrity\"\n    DbType = \"postgres\"\n    Query = \"\"\"SELECT count(*) FROM table WHERE condition;\"\"\"\n    ```\n\n1. **Schedules**\n\n    The cron format with seconds is:\n    seconds minute hour day-of-month month day-of-week\n\n    ```toml\n    [[schedules]]\n    Server = \"Local Postgres\"\n    Rule = \"Check Data Consistency\"\n    CronStr = \"*/5 * * * *\"  # Run every 5 minutes (at 0 seconds)\n    ```\n\n## Building and Running\n\n```bash\n# Build the application\ngo build -o ./build/dataspy .\n\n# Run from project root (where your .env file is located)\n./build/dataspy\n```\n\n### Docker\n\nAlternatively run this with docker\n\n```bash\n# Build the image\ndocker build -t dataspy .\n\n# Run example with environment variables\ndocker run --network=\"host\" \\\n  -e PG_DBCONN=\"host=localhost port=5432 user=postgres password=secret dbname=postgres\" \\\n  -e MSSQL_DBCONN=\"server=localhost;user id=sa;password=secret;port=1433;database=master\" \\\n  -e MySQL_DBCONN=\"root:secret@tcp(localhost:3306)/mysql\" \\\n  dataspy\n```\n\n## Contributing\n\nThis is an active work in progress. Contributions and suggestions are welcome.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanthorell%2Fdataspy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathanthorell%2Fdataspy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanthorell%2Fdataspy/lists"}