The SQLNotes feature of DataWorks allows you to write Markdown texts and SQL code, run the code for queries, and then save the query results. This topic describes how to create and manage SQLNotes files.

Create an SQLNotes file

  1. Go to the SQLNotes page.
    1. Go to the homepage of DataAnalysis. For more information, see Go to the DataAnalysis page.
    2. On the homepage of DataAnalysis, click the SQLNotes card in the Shortcuts section to go to the SQLNotes page.
      Alternatively, click SQLNotes in the top navigation bar to go to the SQLNotes page.
  2. On the SQLNotes page, click the Create an SQLNotes file icon in the Create SQLNotes section.

    The following figure shows the default configuration page of a new SQLNotes file.

    Note You can change the default units based on your business needs.
    Create an SQLNotes file
    Area Description
    Markdown unit A Markdown unit is displayed in Area 1. You can use a Markdown unit in the following methods:
    • You can put a Markdown unit before a code unit to record the analysis purpose of the SQL operations.
    • You can also put a Markdown unit after a code unit to record the preliminary conclusions of the SQL operations.
    Code unit A code unit is displayed in Area 2. You can write SQL statements in this code unit.
    Note We recommend that you create a unit for a group of SQL statements that needs to be independently executed. This way, you can manage different operations within the file.
    Shortcut keys Area 3 describes the following shortcut keys for units:
    • Run a unit: If you want to run a unit, click the unit and press the F8 key.
    • Stop a unit: If you want to stop a unit from running, click the unit and press the F9 key.
    Operation buttons Area 4 displays the operation buttons for units. You can click the buttons to run or stop a specific unit or all units based on your needs.
  3. Select a workspace in which you want to run the units from the Workspace drop-down list in the upper part of the configuration page.
  4. Add a unit.
    1. To add a code unit in the file, select a unit and click +SQL. Alternatively, click +Add Cell in the lower part of the configuration page.
      After you select the added unit, you can write SQL statements in the unit. A bar of feature icons appears above the unit. You can run, move, or remove the unit or add another code unit. You can also click the Format icon to format the SQL statements in the unit or click the Switch to Markdown icon to convert SQL statements to Markdown texts.
    2. To add a markdown unit in the file, select a unit and click +Markdown.
      After you select the added unit, you can write Markdown texts in the unit. A bar of feature icons appears above the unit. You can move or remove the unit or add another Markdown unit. You can also click the Switch to Markdown icon to convert Markdown texts to SQL statements.
  5. Save the SQLNotes file.
    1. Click Save in the upper-right corner of the configuration page.
    2. In the Save File dialog box, enter a name for the SQLNotes file in the File Name field.
    3. Click OK.
  6. Optional:Share the SQLNotes file.
    After you save the SQLNotes file, refresh the page. The Share button is displayed in the upper right corner of the configuration page. Click Share to share the file with specific users. You can use one of the following methods to share the file:
    • Share the file by using a link.

      Click Copy Link to obtain the URL of the current file and send the URL to specific users. Then the users can read and edit the file.

    • Turn on Visible to All.

      If you turn on Visible to All, all the RAM users within the current Alibaba Cloud account can read the SQLNotes file.

    • Grant users the read permissions on the SQLNotes file.

      Make sure that Visible to All is turned off. Then, click Add to specify the RAM users that you want to share the file with. If you use this method to share a file, the specified RAM users can only read the file.

Manage SQLNotes files

On the SQLNotes page, you can view the information about SQLNotes files. You can perform operations such as changing the name or owner of a file. Manage SQLNotes files
Area Description
1 In this area, you can switch between I created and Share it with me to view the SQLNotes files created by the current user or those shared by other users.
2 In this area, you can search for an SQLNotes file by file name.
Note Fuzzy match is supported. You can enter a keyword to view all the files whose names contain the keyword.
3 In this area, you can view the information about each SQLNotes file, including the name, creator, creation time, and time when the file was last updated.
You can also perform the following operations on an SQLNotes file:
  • Rename: Find the required SQLNotes file and click the Rename icon icon in the Operation column.
  • Change Owner: Find the required SQLNotes file and click the Change Owner icon icon in the Operation column. After the owner of the file is changed to a RAM user, the RAM user obtains all the operation permissions on the file. In the meantime, the file is removed from the SQLNotes file list of the current user.
  • Delete: Find the required SQLNotes file and click the Delete icon icon in the Operation column.