Splitgraph has been acquired by EDB! Read the blog post.

Writing custom mount handlers

To mount a custom database into your sgr engine, you have to do three things:

  • Install the foreign data wrapper into the engine (either using PGXN or compiling the wrapper by yourself)
  • Write a Python class deriving from ForeignDataWrapperDataSource that defines the FDW's class and how command line options map to the FDW's own options. For an example, see PostgreSQLDataSource in splitgraph.hooks.data_source.
  • Register the handler in your .sgconfig file:

Registering the handler in such a way will also make it available in the sgr client as an sgr mount subcommand, as well as make it available to be used in Splitfiles.

For an end-to-end example of a custom mount handler querying the Firebase Hacker News API, see Splitgraph's GitHub repository.