Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products.
All content is subject to change and is provided without warranty.
Skip to main content Skip to complementary content

Connect to data sources in load scripts

Data connections in Data load editor and Script let you save shortcuts to the data sources you commonly use: databases, local files, or remote files.

Data connections lists the connections you have saved in alphabetical order grouped by the spaces to which they belong. You can use the search box to narrow the list down to connections with a certain name or type. You can access Data connections by clicking Data sources.

Information noteYou can only see data connections that you own, or have been given rights to access. Please contact your Qlik Sense system administrator to acquire access if required.

Creating a new data connection

Do the following:

  1. Click Data sources.

  2. Click Create new connection.
  3. Under Space, select the space where the connection will be located.

  4. Select the type of data source you want to create from the drop-down list.

    The settings dialog, specific for the type of data source you selected, opens.

  5. Enter the data source settings and click Create to create the data connection.

Deleting a data connection

Do the following:

  1. Click Data sources.

  2. Click Delete on the data connection you want to delete.
  3. Confirm that you want to delete the connection.

The data connection is now deleted.

Editing a data connection

Do the following:

  1. Click Data sources.

  2. Under Data connections, select the space containing the data connection you want to edit.

  3. Click Edit on the data connection you want to edit.
  4. Edit the data connection details. Connection details are specific to the type of connection.

    You may need to provide the connection's credentials.

The data connection is now updated.

Information noteIf you edit the name of a data connection, you also need to edit all existing references (lib://) to the connection in the script, if you want to continue referring to the same connection.

About DataFiles connections

DataFiles connections are automatically created for each space you can access. The connections are available from each space section under Data Connections.

Information noteThe file extension of DataFiles connections is case sensitive. For example: .qvd.

Selecting data from a data connection

If you want to select data from a data connection to load in your app do the following:

  1. Click Data sources.

  2. Create new connection linking to the data source (if the data connection does not already exist).
  3. Data Selection Select data from the connection.

Referring to a data connection in the script

You can use the data connection to refer to data sources in statements and functions in the script, typically where you want to refer to a file name with a path.

In Qlik Cloud Analytics, the syntax for referring to a file in the load script is:

[lib:// (space_name):(connection_name)/(folder_name)/(file_name)]

The full folder path must be provided. Relative paths are not supported.

If the space does not exist, the statement cannot be executed and returns an error.

The folder path can include multiple folders in a hierarchical structure. Each folder_name in the path must be delimited with / characters.

The following are not allowed in the path when referencing files residing in a folder structure:

  • //

  • \

  • \\

  • /./

  • /../

Trailing period symbols (.) in the space, folder, or file name are acceptable as long as they do not appear in the configurations in the above list.

Examples: Non-compliant syntax

These examples are considered invalid syntax for the path:

Load [Transactions] from 'lib:\\Demo:DataFiles\Sales2024\France.qvd';
store [Transactions] into 'lib://Demo:DataFiles/Sales2024/./France.qvd';
Load [Transactions] from 'lib://Demo:DataFiles/Sales2024/../France.qvd';
store [Transactions] into 'lib://Demo:DataFiles//Sales2024//France.qvd';

Depending on the type of script statement being used, non-compliant syntax might cause reload failure, or could still be executed with different behavior. For specific details, see:

You do not need to add the space_name if you are connecting to a personal space.

This example loads the file orders.csv from a personal space defined in the Data data connection.

LOAD * FROM [lib://DataFiles/orders.csv];

This example loads the file orders.csv from a shared space defined in the Data data connection.

LOAD * FROM [lib://TeamSharedConnection:DataFiles/orders.csv];

This example loads the file orders_Europe.csv from the folder Orders By Region within a personal space.

LOAD * FROM [lib://DataFiles/Orders By Region/orders_Europe.csv];

This example loads the file orders_Europe.csv from the folder Orders By Region within a shared, managed, or data space. The name of the space is SalesSpace.

LOAD * FROM [lib://SalesSpace:DataFiles/Orders By Region/orders_Europe.csv];

This example loads the file orders.csv from the current space. If the app is moved to another space, for example, it will use the file orders.csv in the new space.

LOAD * FROM [lib://:DataFiles/orders.csv];

This example loads the table Sales_data from the DataSource database connection in a user's personal space.

LIB CONNECT TO 'DataSource';
LOAD *;
SQL SELECT * FROM `Sales_data`;

Example: Loading from a database in another space

This example loads the table Sales_data from the DataSource database connection in the current space.

LIB CONNECT TO ':DataSource';
LOAD *;
SQL SELECT * FROM `Sales_data`;

Example: Loading from a database in a specific space

This example loads the table Sales_data from the DataSource database connection in the space SalesSpace.

LIB CONNECT TO 'SalesSpace:DataSource';
LOAD *;
SQL SELECT * FROM `Sales_data`;

Examples: Loading from analytic connections

The following examples show how to write expressions to load data from analytic connections. Use the SSE syntax to connect to data from an analytic connection.

These examples demonstrate the use of the connections in scripts. For examples showing how to reference analytic connections in charts, see Using analytic connections and server-side extensions syntax.

EXTENSION endpoints.ScriptEval('{"RequestType":"endpoint", "endpoint":{"connectionname":":Amazon_Titan_(Amazon_Bedrock)"}}', QuestionsTable{Question_ID,Question});
EXTENSION endpoints.ScriptEval('{"RequestType":"endpoint", "endpoint":{"connectionname":"Amazon_Titan_(Amazon_Bedrock)"}}', QuestionsTable{Question_ID,Question});

This example loads data from the connection named Amazon_Titan_(Amazon_Bedrock) in the space SalesSpace.

EXTENSION endpoints.ScriptEval('{"RequestType":"endpoint", "endpoint":{"connectionname":"SalesSpace:Amazon_Titan_(Amazon_Bedrock)"}}', QuestionsTable{Question_ID,Question});

Learn more

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!