To connect RisingWave to a Neon database for Change Data Capture (CDC), you first need to configure your Neon project.

1. Create a Neon project

If you haven’t already, sign up for a Neon account and create a project. This will provision a new serverless PostgreSQL database. Note your project’s connection details.

2. Enable logical replication

Connect to your Neon database using the provided SQL Editor or any compatible psql client.

Run the following command to set the wal_level to logical, which is required for CDC.

ALTER SYSTEM SET wal_level = logical;

Your Neon project may need to restart for this change to apply.

3. Configure a replication user

Create or alter a user, granting them the necessary roles for replication.

-- Create a new user with a secure password
CREATE USER <user_name> WITH REPLICATION LOGIN PASSWORD '<your_password>';

-- Or, assign attributes to an existing user
ALTER USER <user_name> WITH REPLICATION LOGIN;

You can verify the roles by running \du in psql.

4. Grant required privileges

Finally, grant the user the necessary privileges on the database and schemas you want to capture changes from.

-- Grant connection access to the database
GRANT CONNECT ON DATABASE <database_name> TO <user_name>;

-- Grant usage on the schema
GRANT USAGE ON SCHEMA <schema_name> TO <user_name>;

-- Grant select on all tables in the schema
GRANT SELECT ON ALL TABLES IN SCHEMA <schema_name> TO <user_name>;

Next step

Now that your Neon database is configured, you can proceed to connect RisingWave.

➡️ Connect to PostgreSQL CDC