Connect to an existing SQL database

Note: This driver is being superseded by the GRIPPER engine

GRIP supports modeling an existing SQL database as a graph. GRIP has been tested against PostgreSQL, but should work with MySQL (4.1+) and MariaDB.

Since GRIP uses Go's database/sql package, we could (in thoery) support any SQL databases listed on: https://github.com/golang/go/wiki/SQLDrivers. Open an issue if you would like to request support for your favorite SQL database.

Configuration Notes

Example

Given the following example database: https://github.com/bmeg/grip/blob/master/test/resources/postgres_smtest_data.dump

Load this dump file into your own postgres instance by running:

createdb --host localhost --port 15432 -U postgres smtest
psql --host localhost --port 15432 -U postgres smtest < postgres_smtest_data.dump

GRIP Configuration:


Drivers:
  esql:
    ExistingSQL:
      DataSourceName: "host=localhost port=15432 user=postgres dbname=smtest sslmode=disable"
      Driver: postgres

      Graphs:
        - Graph: test-graph
          Vertices:
            - Table: users
              Label: users
              GidField: id

            - Table: products
              Label: products
              GidField: id

            - Table: purchases
              Label: purchases
              GidField: id

          Edges:
            - Table: purchase_items
              Label: purchasedProducts
              GidField: id
              From:
                SourceField: purchase_id
                DestTable: purchases
                DestField: id
              To:
                SourceField: product_id
                DestTable: products
                DestField: id

            - Table: ""
              Label: userPurchases          
              GidField: ""
              From:
                SourceField: ""
                DestTable: users
                DestField: id
              To:
                SourceField: ""
                DestTable: purchases
                DestField: user_id