In this tab you can create, edit and run your SQL and DDL statements and scripts.
Icons & actions:
Create a new SQL Code Window: The SQL tab can have multiple SQL Code Windows. Use this button to manually create a new window.
Delete a SQL Code Window (or all): Remove the current SQL Code Window or all the windows.
Switch between available SQL Code Windows: The label between the arrows indicates which the current window is. If you click on the label you will see part of the content of that window and you can click on it to switch to that window, or use the arrows on the sides to switch sequentially between windows.
New, Open and Save SQL Scripts: Clears the screen to start a new SQL script, opens a new script or saves it.
Execute query (or queries): If no statements are selected Dev4Snow will execute all of the available statements in the screen one after the other. If some statements are selected Dev4Snow will execute only the selection.
If the lock for tracking in GIT is closed and you executed code that included DDL statements, the code for the DDL statements will be automatically included in the local GIT Repo –under the corresponding script for the specific database/schema.
If Auto-Refresh=ON and you executed DDL statements that included the creation, deletion or renaming of objects, the schema(s) involved in those objects will be flagged for background cache refresh –which will happen after a few seconds of running the statements.
Stop running queries: Sends an instruction to Snowflake to stop the currently running query (or queries).
Start tracking in GIT local repo: If the lock for tracking in GIT is closed and you executed code that included DDL statements, the code for the DDL statements will be automatically included in the local GIT Repo –under the corresponding script for the specific database/schema.
Configure GIT repo: There are three options under this button:
Auto-Refresh (ON/OFF): If Auto-Refresh=ON and you executed DDL statements that included the creation, deletion or renaming of objects, the schema(s) involved in those objects will be flagged for background cache refresh –which will happen after a few seconds of running the statements.
Undo: Click this icon to undo editor operations.
Redo: Click this icon to redo editor operations that you previously reversed using the Undo icon.
Toggle Word Wrap: Toggles the editor to show long lines either as multiple lines or as a single line.
Find and Replace: Use this option to Find, or to Find & Replace, text in the current SQL Code Window.
Show or hide Results window: Shows or hides the panel where the query results are displayed.
SQL context menu:
Context menu > Copy / Paste: For copying and pasting code.
Context menu > Execute statements: Same as executing via “Execute query” icon.
Context menu > Add selected statements to Git Repo: Select one or more statements and click this option to manually add statements to the Git repo. Even if you are not automatically tracking in Git -lock is open- you can manually use this option to add DDL or DML statements to the configured Git local repo.
Dev4Snow uses your selected databases and schemas, plus the cached tables and views to auto-complete while you type.
Suppose you have the following database structure, and you selected the SNOWFLAKE_SAMPLE_DATA db as favorite with all of its schemas:
Now in the SQL Window you start typing:
You will be presented with all the databases starting with “SN”, including “SNOWFLAKE_SAMPLE_DATA”. Use the arrow keys to select this DB, then hit <TAB> key (or ENTER) to auto-complete the rest of the DB Name, so now you have the following:
select * from SNOWFLAKE_SAMPLE_DATA
Now type the dot (“.”) and you will be presented with all the schemas available for database SNOWFLAKE_SAMPLE_DATA. Use the arrow keys to select “TPCH_SF1000” and hit <TAB> key (or ENTER):
Type another dot, and you will be presented with all the tables and views available in the schema. Select the “CUSTOMER” table and hit <TAB> key (or ENTER):
You continue writing the query and now you want to include conditions:
select * from SNOWFLAKE_SAMPLE_DATA.TPCH_SF1000.CUSTOMER where
To bring in the available columns for that table type an “@” symbol:
Select “C_NAME” and hit <TAB> key (or ENTER). Now you have the following (notice that the “@” symbol has been deleted, since it’s only used to indicate that you want to bring in all the columns available for tables).
select * from SNOWFLAKE_SAMPLE_DATA.TPCH_SF1000.CUSTOMER where C_NAME
Please check that you are indeed assigning a column that belongs to that table, the table name is indicated inside round brackets. All the tables that you have selected using auto-complete during your session -by using the arrows and <TAB> key (or ENTER)- will be available to bring in their columns. Auto-complete does not work for copy-pasted tables/views –or even for tables/views dragged from the tree. Also you need to indicate fully qualified object names for it to work –so you have to start with the DB name.