In order to connect your Snowflake account to Magnify, you will need to create a Reader Account that Magnify will use to ingest all telemetry data into our systems on your behalf. This document provides step-by-step instructions for creating the Reader Account, creating a Data Share to share with the Reader Account, and configuring the Reader Account so we can read from it easily.
Step 1: Set up Reader Account
- Sign in to the Snowsight instance as an Account Administrator. If the user role you have used to login does not default to Account Administrator then you will need to click your user name in the upper left hand corner, select the drop down arrow and choose Switch Role → ACCOUNTADMIN.
- On the menu pane navigate to Data → Private Sharing. Select the Reader Accounts tab and click + New.
- Add new Reader Accounts details and Select Create Account. Please keep the login username and password handy as they will be required at the time of integration. It may take up to 5 minutes for the Reader Account to be created.
- Click on the link widget to copy the Locator URL and paste it in a notepad for further use. This is a unique url to access the Reader Account.
Step 2: Create a Data Share
Next, we need to create a Direct Share using the Reader Account we just created, which will have access to all the data that needs to be ingested into Magnify.
- Select Create a Direct Share, by navigating to Data → Private Sharing and selecting the Shared By My Account tab. Once there, click the Share drop down button and select Create a Direct Share.
- Select the database, schema and list of all the tables that needs to be a part of the share.
- Once you’ve selected all necessary tables click Done. A pop-up window will appear prompting you to name your Data Share and select the account that needs shared access. The account name will be the name from the Locator URL for the Reader Account that was created as a part of Step 1.4.
- Select Create Share on entering all the information.
- In order for each of the selected tables to be accessed through the Data Share, change_tracking must be enabled to true so Magnify can identify all of the new records being added to the database table. The change tracking can be set to true by running the query in step 2.e. To run the query, you must first create a worksheet by navigating to Worksheets in the navigation pane.
- Create a new worksheet by clicking + Worksheet.
- Make sure the appropriate account warehouse is selected to run the worksheets query.
- To Edit the worksheet name, We can enter it using the dropdown present on the top-left header. Click anywhere on the worksheet after entering the name and it will automatically rename the worksheet.
- Once you have opened a worksheet, execute the query below replacing the database name, schema name and table name with the actual names of the databases, schemas, and tables that will be ingested by Magnify.
alter table {database name}.{schema name}.{table name} set change_tracking = true;
Step 3: Configure the Reader Account
- Login to the Reader Account you created in Step 1.3 by navigating to the URL from Step 1.4. Enter the username and password that you defined while creating the Reader Account in Step 1.3.
- Upon login, verify the default role for the account is the Account Administrator role. If not, click your user name in the upper left hand corner, select the drop down arrow and choose Switch Role → ACCOUNTADMIN.
- Create a warehouse, by navigating to Admin → Warehouses and selecting + Warehouse in the upper right hand corner.
- Select the following configurations for the warehouse (choose a meaningful name for the warehouse, i.e. COMPUTE_WH) and click Create Warehouse.
- Once the warehouse has been created navigate to Data → Private Sharing and select the Shared With You tab to get access to the share for the readers account.
- Give a meaningful name to the shared database and select the SYSADMIN role from the drop down as an additional role that will have access to the Data Share in the Reader Account.
- On successful execution of the above steps, a database will be created in the Reader Account and can be accessed by navigating to Data → Databases as shown below.
- Create a new database so we can create stream tables to read new records coming from the parent tables on a regular basis. Navigate to Data → Databases and select + Database and choose a name for your database (i.e. STREAM_DB).
- Select the database you just created and add a new schema by clicking + Schema.
- For every table that is ingested as a part of the Data Share, a stream has to be created on top of it. To create the stream, select the newly created schema and navigate to the Create dropdown and select Stream.
- When creating a new stream a pop-up window will appear, in that window execute the query below replacing the following:
- STREAM_DATABASE_NAME: Stream DB that was created
- STREAM_SCHEMA_NAME: Stream DB schema that was created
- STREAM_TABLE_NAME: Stream DB table – Set it to stream_{original table name} for easy identification
- READER_DATABASE_NAME: Database ingested via the share
- READER_SCHEMA_NAME: Database Schema available via the share
- READER_TABLE_NAME: Original Table that the stream is being created on
create or replace stream {STREAM_DATABASE_NAME}.{STREAM_SCHEMA_NAME}.{STREAM_TABLE_NAME}
on table {READER_DATABASE_NAME}.{READER_SCHEMA_NAME}.{READER_TABLE_NAME};
Below is an example of how the query should look when executed.
- Follow steps 10 and 11 for every table that is a part of the Data Share.
Updated