SQL clients
Materialize is wire-compatible with PostgreSQL, which means it integrates with many SQL clients that support PostgreSQL (see Tools and Integrations). In this guide, we’ll cover how to connect to your Materialize region using common SQL clients.
Connection parameters
You can find the credentials for your Materialize region in the Materialize console, under Connect externally in the navigation bar.
Field | Value |
---|---|
Host | Materialize host name. |
Port | 6875 |
Database name | Database to connect to (default: materialize). |
Database username | Materialize user. |
Database password | App password for the Materialize user. |
SSL mode | Require |
Before connecting, double-check that you’ve created an app-password for your
user. This password is auto-generated, and prefixed with mzp_
.
Runtime connection parameters
ALTER ROLE...SET
command.
You can pass runtime connection parameters (like cluster
, isolation_level
,
or search_path
) to Materialize using the options
connection string
parameter,
or the PGOPTIONS
environment variable.
As an example, to specify a different cluster than the default defined for the
user and set the transactional isolation to serializable on connection using
psql
:
# Using the options connection string parameter
psql "postgres://<MZ_USER>@<MZ_HOST>:6875/materialize?sslmode=require&options=--cluster%3Dprod%20--transaction_isolation%3Dserializable"
# Using the PGOPTIONS environment variable
PGOPTIONS='--cluster=prod --transaction_isolation=serializable' \
psql \
--username=<MZ_USER> \
--host=<MZ_HOST> \
--port=6875 \
--dbname=materialize
Tools
DataGrip
pg_catalog
in Materialize,
some DataGrip features might not work as expected.
To connect to Materialize using DataGrip, follow the documentation to create a connection and use the PostgreSQL database driver with the credentials provided in the Materialize console.
DBeaver
Minimum requirements: DBeaver 23.1.3
To connect to Materialize using DBeaver, follow the documentation to create a connection and use the Materialize database driver with the credentials provided in the Materialize console.
The Materialize database driver depends on the PostgreSQL JDBC driver. If you don’t have the driver installed locally, DBeaver will prompt you to automatically download and install the most recent version.
Connect to a specific cluster
By default, Materialize connects to the pre-installed default
cluster.
To connect to a specific cluster, you must
define a bootstrap query in the connection initialization settings.
-
Click on Connection details.
-
Click on Connection initialization settings.
-
Under Bootstrap queries, click Configure and add a new SQL query that sets the active cluster for the connection:
SET cluster = other_cluster;
Alternatively, you can change the default value of the cluster
configuration
parameter for a specific user (i.e. role) using the ALTER ROLE...SET
command.
Show system objects
By default, DBeaver hides system catalog objects in the database explorer. This
includes tables, views, and other objects in the mz_catalog
and mz_internal
schemas.
To show system objects in the database explorer:
- Right-click on the database connection in the Database Navigator.
- Click on Edit Connection.
- In the Connection settings tab, select General.
- Next to the Navigator view, click Customize.
- In the Navigator settings dialog, check the Show system objects checkbox.
- Click OK.
TablePlus
pg_catalog
in Materialize,
some TablePlus features might not work as expected.
To connect to Materialize using TablePlus, follow the documentation to create a connection and use the PostgreSQL database driver with the credentials provided in the Materialize console.
psql
psql
are supported by Materialize yet, including some backslash meta-commands.
Start by double-checking whether you already have psql
installed:
psql --version
Assuming you’ve installed Homebrew:
brew install libpq
Then symlink the psql
binary to your /usr/local/bin
directory:
brew link --force libpq
Start by double-checking whether you already have psql
installed:
psql --version
sudo apt-get update
sudo apt-get install postgresql-client
The postgresql-client
package includes only the client binaries, not the PostgreSQL server.
For other Linux distributions, check out the PostgreSQL documentation.
Start by double-checking whether you already have psql
installed:
psql --version
Download and install the PostgreSQL installer certified by EDB.