/demo-collocated-external-functions

This repo includes a standalone demonstration of using SingleStore external functions. External functions allow you to define a user defined function in SingleStore which, when executed, will call out to an externally defined web service.

Primary LanguageGo

Local external functions demo using Docker Compose

Attention: The code in this repository is intended for experimental use only and is not fully tested, documented, or supported by SingleStore. Visit the SingleStore Forums to ask questions about this repository.

This repo includes a standalone demonstration of using SingleStore external functions. External functions allow you to define a user defined function in SingleStore which, when executed, will call out to an externally defined web service.

SingleStore is a scale out relational database optimized for transactions and analytics. This is just one of many extensibility options that SingleStore offers to help it run your workload. You can run SingleStore yourself or use our cloud offering (sign up here for $500 in credits!).

Using this repo

  1. Sign up for a SingleStore account and get your license key from the customer portal.
  2. Add the license key to your shell environment:
    export SINGLESTORE_LICENSE="YOUR LICENSE KEY HERE"
  3. Run docker-compose up --build in this directory, check the logs for errors
  4. Open SingleStore Studio in your browser
  5. Login using the username root and password test
  6. Navigate to the SQL Editor
  7. Run the following SQL commands line by line:
    use test;
    
    -- let's first make sure it works
    select * from tokenize("Cool! External functions work!");
    
    -- we can extract just the tokens
    select encoded::tokens from tokenize("Cool! External functions work!");
    
    -- now let's join it with a table
    select id, encoded::tokens from sample_data, tokenize(sample_data.t);