SingleStore DB


The following example demonstrates the steps performed by a user user1 to write all rows of the table t1 of the database productdb to an S3 bucket using a connection link:

  1. On user request, the DBA (who has the CREATE LINK permission) creates an S3 connection link demouser_S3:

    CREATE LINK productdb.demouser_S3 AS S3
    CREDENTIALS '{"aws_access_key_id":"your_access_key_id","aws_secret_access_key":"your_secret_access_key"}'
    CONFIG '{"region":"us-east-1"}'
    DESCRIPTION 'Product list';
  2. The DBA grants the SHOW LINK permission to user1.

    GRANT SHOW LINK ON productdb.* TO 'user1';

    This allows user1 to use the S3 connection link demouser_S3 and any other connection links defined in the productdb database.

    user1 can run the SHOW LINKS command to view all the connection links in a database. For example, if a second connection link, demouser2_S3 had been created in the productdb database, running SHOW LINKS would return the following results:

    SHOW LINKS ON productdb;
    | Link                    | Type   | Description                 |
    | demouser_S3             | S3     | Product list                |
    | demouser2_S3            | S3     | Brand list                  |
  3. user1 runs the SELECT .. INTO LINK command to write the contents of the table t1, to the S3 bucket at the specified path, using the S3 connection link demouser_S3 stored in the productdb database.

    USE productdb;
    SELECT * FROM t1 INTO LINK demouser_S3 'testing/output';