What are SQL Parameters?

How to use SQL Parameters with your import?

FAQs for SQL Parameters

What are SQL Parameters?

When using a custom SQL query with Coefficient, you can now add a Parameter that will dynamically point to a specific cell/range of cells/values in your sheet. This will allow you to create complex queries + Parameters that allow your teammates to enter the needed data on a cell for the import to run. How cool is that! 🤓

How to use SQL Parameters with your import?

SQL Parameters can be used with any Coefficient Integration that has custom SQL queries as an import option. These include MySQL, PostgreSQL, MS SQL, Snowflake, RedShift, etc.

(This example will use MySQL and set the value for the “film.release_year” column using the SQL Parameter feature. The goal is to pull a list of movies based on the value we set for cell B1 in a new tab.)

  1. To set the SQL parameter, on a new sheet, go to cell “B1” and then enter “2006”. This value will be used in the film.release_year column.

Screenshot 2023-01-25 at 7.23.59 PM.png

  1. Select “Import from…” **from the main menu.

    Screenshot 2023-01-25 at 7.29.50 PM.png

  2. Select MySQL and choose “Custom SQL Query”.

    Untitled

  3. The Data Preview window will appear. You will see all your previously created parameters listed but you can always add a new one.

NOTE: The parameters listed are other parameters in the current spreadsheet and are not shared across spreadsheets.

Parameters.png

  1. Click the “Add another parameter” button to add your new SQL Parameter*.* Each parameter name must be UNIQUE. You will need to manually enter the cell/range of cells referenced in your Sheet. The format of your cell/range should be ‘<Name of your sheet>’!<cell or range of cells>”. (Example: “Import1!A1” or “Import1!A1:D1”)’

    Screen Shot 2022-10-07 at 4.24.56 PM.png

  2. Add your query to this import. If you are using the parameter, you MUST include “{{” before and “}}” after for it to be valid. Click the “Refresh Preview” button to see how your data is shown.

<aside> 💡 ProTip: You can start typing “{{” and a list of available variables should appear so you do not have to copy and paste it. Make sure you place “}}” at the end.

</aside>

Screen Shot 2022-10-07 at 4.33.09 PM.png

NOTE: The system should automatically list your parameters for easy selection once you typed in “{{”.

  1. Give your import a UNIQUE name, and click “Import”.