Connect your data to DataLab

DataLab makes querying databases and data warehouses a breeze. You can query a growing list of database technologies with DataLab's SQL cell:

For data storage solutions and technologies that are not yet natively supported through the SQL cell, you can use Environment variables in combination with Python or R to securely read and write data. Visit the dedicated documentation articles for instructions. If you'd like us to add native support or documentation for additional database technologies, reach out!

Preparing to connect

To set up a connection between DataLab and a database, you will provide DataLab with the credentials for a user account in your database. DataLab will use these credentials to execute queries against the database. The permissions of this user account will control which tables and records you can access when querying this database.

We recommend you create (or ask your database admin to create) a new database user specifically for using with DataLab. Grant this new user read-only permission for the schemas and tables you want users to be able to query with the SQL cell.

In addition to getting the credentials, ensure your database:

If your database or network environment can not be configured to meet the above requirements, reach out; we're happy to help!

How to connect

  1. Sign in to DataLab.

  2. Click Databases in the sidebar

  3. Click Connect Database

  4. Follow the instructions to connect your database and test the connection.

Once database credentials are filled in and the database connection is set up, for security reasons the credentials can not be consulted again.

Use a sample database

Don't have a database but still want to experiment with native database connections and SQL cells? DataLab features sample databases for every natively supported database technology. You can select the sample database in the dropdown when you create a SQL cell.


Who can see and use database connections I set up?

If you set up a database connection in your personal account, only you can use and edit this database connection. It can not be shared with other users. This means that you cannot invite other users as an editor to a personal workbook that has a database connected.

If you set up the database connection in a group that you're a part of, you can use and edit the database connection, but other members of the group can also use the database connection.

We will soon add role-based access control on database connections, so that you are able to control access to database connections more granularly.

How do I know if my database is accessible on the internet?

A database is "publicly accessible" if the server the database is hosted on can be reached via any internet connection, not requiring users to be logged into a VPN or connected to a private network.

To check if your database is publicly accessible, run the following command on a computer that's not logged into your VPN or private network. Replace your_db_host and your_db_port with the host and port of your database:

  • Linux or OSX: nc -v your_db_host your_db_port

  • Windows: telnet your_db_host your_db_port

Databases that are running on your computer (i.e. on localhost) are also not publicly accessible, unless you expose them to the internet through tools like ngrok or Tailscale.


DataLab allows you to use TLS/SSL (Transport Layer Security/Secure Socket Layer) to encrypt communication with your database. This encrypts data while it's in transit between your database and DataLab. For auditing purposes, DataLab tracks who executed which query in what workbook and when.

DataCamp is ISO 27001 certified. Your data is protected by solid security practices and policies. For more information, see DataCamp's approach to security and privacy policy.

Last updated