Overview
Connecting PostgreSQL to Pylar allows you to query and analyze your PostgreSQL data directly from Pylar. Your data remains in PostgreSQL—Pylar indexes it for easier querying and executes queries on your PostgreSQL infrastructure.Prerequisites
- ✅ Pylar account with Analyst role or higher
- ✅ PostgreSQL database access
- ✅ Database credentials (host, port, database name, username, password)
- ✅ Ability to whitelist IP addresses in PostgreSQL firewall
Step 1: Navigate to Connections
- In your Pylar workspace, click on the “Connections” tab located in the sidebar
- You’ll see the list of available data sources
Step 2: Select PostgreSQL
From the list of available data sources, select “PostgreSQL”. The connection setup screen will open.Step 3: Enter Connection Details
You’ll need the following information to connect:Host
The hostname or IP address of your PostgreSQL server. Examples:db.example.com192.168.1.100postgres.example.com
Port
The port number for PostgreSQL. Default:5432
Note: If your PostgreSQL server uses a non-standard port, enter that port number.
Database Name
The name of the database you want to connect to. Example:production, analytics, customer_data
Username
Your PostgreSQL username that has access to the database. Best Practice: Create a dedicated user for Pylar with read-only permissions.Password
The corresponding password for your PostgreSQL username.Use a dedicated PostgreSQL user account for Pylar with read-only permissions when possible. This enhances security and allows for better access control.
Step 4: Whitelist Pylar IP Address
Critical Step: Whitelist Pylar’s IP address to ensure seamless connectivity. Pylar IP Address:34.122.205.142
How to whitelist:
Option 1: PostgreSQL pg_hba.conf
- Edit the
pg_hba.conffile on your PostgreSQL server - Add a line allowing connections from Pylar’s IP:
- Reload PostgreSQL configuration:
Option 2: Cloud Provider Firewall
If using a cloud-hosted PostgreSQL (AWS RDS, Google Cloud SQL, Azure Database): AWS RDS:- Go to RDS Security Groups
- Add inbound rule: Allow PostgreSQL (port 5432) from IP
34.122.205.142
- Go to Cloud SQL instance
- Add authorized network:
34.122.205.142/32
- Go to Azure Portal → Firewall settings
- Add client IP:
34.122.205.142
Whitelisting the IP address is crucial for establishing a secure and stable connection. Without it, Pylar will not be able to connect to your PostgreSQL database.
Step 5: Test Connection
- Click the “Submit” button
- Pylar will test the connection to your PostgreSQL database
- If successful, you’ll see a success message
- If it fails, you’ll be prompted to make corrections to your database credentials
A successful connection test means Pylar can reach your PostgreSQL server and authenticate. Verify all details are correct before proceeding.
Step 6: Save and Connect
Once the connection test is successful:- Click “Save” to save your configuration
- You’ll be prompted to give the connection a schema name
- Enter a descriptive name (e.g.,
postgres_productionoranalytics_db) - Save the configuration
- Lowercase letters only
- Numbers and underscores allowed
- No spaces or special characters
Step 7: Start Exploring
Your PostgreSQL database is now connected to Pylar. You can:- Query your data: Use the SQL IDE to query PostgreSQL tables
- Create views: Build views on your PostgreSQL data
- Join with other sources: Combine PostgreSQL data with other connected sources
Using Your PostgreSQL Connection
Query PostgreSQL Data
Reference your connection by the schema name you provided:Join with Other Sources
Join PostgreSQL data with other connected sources:Troubleshooting
Issue: Connection test fails
Solutions:- Verify host and port are correct
- Check username and password
- Ensure IP address
34.122.205.142is whitelisted - Verify database name exists
- Check PostgreSQL is accessible from the internet
Issue: “Connection refused” error
Solutions:- Verify PostgreSQL is running
- Check port number is correct (default 5432)
- Ensure firewall allows connections from Pylar’s IP
- Verify PostgreSQL is configured to accept remote connections
Issue: “Authentication failed” error
Solutions:- Verify username and password are correct
- Check user has permissions to access the database
- Review PostgreSQL authentication settings
- Ensure user is not locked or disabled
Issue: “Network or security block” error
Solutions:- Confirm IP address
34.122.205.142is whitelisted - Check firewall rules allow PostgreSQL port (5432)
- Review network security group settings
- Verify PostgreSQL
listen_addressesincludes the network interface
Best Practices
User Account Security
- ✅ Create a dedicated PostgreSQL user for Pylar
- ✅ Grant only necessary permissions (read-only if possible)
- ✅ Use role-based access control
- ✅ Regularly audit user permissions
Network Security
- ✅ Whitelist only Pylar’s IP address
- ✅ Use SSL/TLS connections when possible
- ✅ Monitor connection logs
- ✅ Review failed connection attempts
Connection Naming
- ✅ Use descriptive names:
postgres_prod,postgres_analytics - ✅ Include environment information
- ✅ Be consistent across your workspace
Next Steps
Now that PostgreSQL is connected:- Creating Data Views - Create views using PostgreSQL data
- Cross-Database Joins - Join PostgreSQL with other sources
- Connection Security - Secure your connections
Create Views
Use your PostgreSQL connection to create data views