{"id":18646770,"url":"https://github.com/metabase/sample-driver","last_synced_at":"2025-05-08T21:11:36.239Z","repository":{"id":49870947,"uuid":"457114134","full_name":"metabase/sample-driver","owner":"metabase","description":"A sample Metabase driver that connects to a database","archived":false,"fork":false,"pushed_at":"2024-08-30T18:49:44.000Z","size":24,"stargazers_count":4,"open_issues_count":3,"forks_count":1,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-08T21:11:25.634Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","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/metabase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-08T21:44:41.000Z","updated_at":"2024-12-06T06:18:51.000Z","dependencies_parsed_at":"2022-09-05T15:10:08.437Z","dependency_job_id":null,"html_url":"https://github.com/metabase/sample-driver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fsample-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fsample-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fsample-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fsample-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metabase","download_url":"https://codeload.github.com/metabase/sample-driver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253149616,"owners_count":21861739,"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":[],"created_at":"2024-11-07T06:22:30.088Z","updated_at":"2025-05-08T21:11:36.190Z","avatar_url":"https://github.com/metabase.png","language":"Clojure","funding_links":[],"categories":["Metabase Examples"],"sub_categories":["Official Examples"],"readme":"# Note: build instructions for this are out of date, please refer to the [build instructions for our sample Sudoku Driver instead](https://github.com/metabase/sudoku-driver/tree/master).\n\n# Metabase Sample Driver\n\nThis is an example of a 3rd party driver, similar to the [sudoku-driver](https://github.com/metabase/sudoku-driver), with the following differences:\n\n* it connects to a real (Postgres) database and executes queries there\n* it has the test extensions defines, so that the full Metabase core test suite can run against it\n\n**Note**: although this is a functionally identical clone of the Postgres driver we ship with the product, it should not be used in production.  It will not be maintained regularly or supported for production usage.\n\n## Usage\n\nBuild the same way as the suduko-driver\n\n`clojure -X:dev:build`\n\n## Testing\n\n### Set Up\nRunning the Metabase test suite using your driver requires a bit of one-time setup.  You will need to create (or edit, if you have an existing one), your personal `deps.edn` file at `~/.clojure/deps.edn`, to add a new alias for your custom driver.  Note that if you have this `:aliases` map already, you will just need to create a new entry here.\n\n```\n{:aliases {\n  :user/sample-driver {:extra-paths [\"/path/to/sample-driver/test\"]\n                       :extra-deps {metabase/sample-driver {:local/root \"/path/to/sample-driver\"}}}\n}}\n```\n\n### Interactive Testing\n\nTo run Metabase tests, go to your [Metabase core](https://github.com/metabase/metabase) repository, then run the following:\n\n```\nMB_SAMPLE_DRIVER_TEST_PLUGIN_MANIFEST_PATH=/path/to/sample-driver/resources/metabase-plugin.yaml clojure -M:dev:ee:ee-dev:drivers:drivers-dev:user:trace:deps-alpha:user/sample-driver:nrepl \u003e/tmp/metabase/repl.out 2\u003e\u00261\n```\n\nIf you want to use remote Java debugging to diagnose test issues, you can add the following options right after `clojure` above.  These will enble the remote debugger (on port `15319`, although you can change it), and also disable local variable clearing, so you can more easily walk up the call stack when suspended at a breakpoint.\n\n`-J-Dclojure.compiler.disable-locals-clearing=true -J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15319`\n\nOnce the nREPL starts up, you can run the following:\n\n```\n;; load the interactive testing namespace\n(require '[dev.driver.testing.interactive :as interactive])\n\n;; test your driver interactively\n(interactive/interactively-test-driver :sample-driver)\n```\n\nAt this point, you should see a series of prompts on the screen to enter all the driver's connection properties.  Enter a value for each one, hitting enter after each value.  At the end, you will see some output like the following:\n\n```\nStoring to store db-details to `user/details`.\nRun `(user/test-connect!) to test a connection using these details`.\nUse `(user/run-tests!)` to execute tests against the connection details you entered.  Pass an optional argument to only run certain tests.  Ex:\n  `(run-tests! 'metabase.query-processor-test.string-extracts-test)`\n```\n\nNow, you can simply run `details` to see the map of connection details you just entered (which corresponds to the values you would type in the UI Admin section for this database).\n\nTo test that a connection can be successfully established, just run `(test-connect!)` and you should see `Successfully connected` (or an error message if it fails).  You can also run a small test suite using:\n\n```\n(run-tests! 'metabase.query-processor-test.string-extracts-test)\n```\n\nTo run the full test suite, simply leave out the argument, but note this is involved and will take a while.  In either case, a report will be printed at the end.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetabase%2Fsample-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetabase%2Fsample-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetabase%2Fsample-driver/lists"}