Example - Sync from PostgreSQL to Tacnode
This guide provides detailed instructions for setting up data synchronization from PostgreSQL to Tacnode, including prerequisites, permissions, and configuration requirements.
Prerequisites
Network Configuration
Ensure network connectivity is properly configured. For detailed network setup instructions, see Data Sync Network Configuration.
Required Permissions
Permission requirements depend on the type of synchronization job:
Full Synchronization Only
For jobs that only perform full data synchronization, grant the following permissions to your synchronization user:
Where:
${schema1}
,${schema2}
: Schema names that require synchronization${user}
: The username for the synchronization job
Full + Incremental Synchronization
Incremental synchronization requires a dedicated user with replication permissions. Cloud providers typically don't allow granting replication permissions to existing users, so you must create a new user.
1. Connect with high-privilege account:
2. Create CDC synchronization user:
3. Grant necessary permissions to the CDC user:
Incremental Synchronization Setup
Incremental synchronization requires additional PostgreSQL configuration:
1. Configure WAL Level
Set the Write-Ahead Logging (WAL) level to support logical replication:
Self-hosted PostgreSQL:
- Edit
postgresql.conf
: - Restart the PostgreSQL service
Cloud PostgreSQL (AWS RDS, GCP Cloud SQL, Azure Database):
- Access your cloud provider's database console
- Modify the database parameter group
- Set
wal_level = logical
- Apply changes and restart the database instance
2. Create Publication
Publications define which tables are available for replication.
Connect with replication privileges:
Create publication for all tables:
Or create publication for specific tables:
Verify publication:
Data Source Configuration
Configure the PostgreSQL connection using these required parameters:
Parameter | Description | Example |
---|---|---|
Host | PostgreSQL server address | postgres.example.com |
Port | PostgreSQL service port | 5432 (default) |
Database | Target database name | production_db |
Username | User with required permissions | sync_user or cdc_user |
Password | Password for the specified user | secure_password |
Connection String Format
For programmatic access, you can use connection strings:
Default Object Mapping
Tacnode uses the following default mapping rule for PostgreSQL objects:
Mapping Logic:
- Source:
database.schema.table
(PostgreSQL format) - Target:
database.schema.table
(Tacnode format, preserving schema structure)
Example:
- PostgreSQL table:
ecommerce.public.users
- Tacnode table:
ecommerce.public.users
Data Type Mapping
PostgreSQL types map directly to Tacnode types in most cases. Array types are indicated with a leading underscore (_
).
Integer Types
PostgreSQL Type | Tacnode Type | Description |
---|---|---|
INT2 | INT2 | 16-bit integer |
_INT2 | _INT2 | Array of 16-bit integers |
INT4 | INT4 | 32-bit integer |
_INT4 | _INT4 | Array of 32-bit integers |
INT8 | INT8 | 64-bit integer |
_INT8 | _INT8 | Array of 64-bit integers |
Character Types
PostgreSQL Type | Tacnode Type | Description |
---|---|---|
CHAR | CHAR | Fixed-length character |
_CHAR | _CHAR | Array of fixed-length characters |
BPCHAR | BPCHAR | Blank-padded character |
_BPCHAR | _BPCHAR | Array of blank-padded characters |
VARCHAR | VARCHAR | Variable-length character |
_VARCHAR | _VARCHAR | Array of variable-length characters |
TEXT | TEXT | Variable-length text |
_TEXT | _TEXT | Array of text values |
Numeric Types
PostgreSQL Type | Tacnode Type | Description |
---|---|---|
NUMERIC | NUMERIC | Exact numeric |
_NUMERIC | _NUMERIC | Array of numeric values |
FLOAT4 | FLOAT4 | Single precision floating point |
_FLOAT4 | _FLOAT4 | Array of single precision floats |
FLOAT8 | FLOAT8 | Double precision floating point |
_FLOAT8 | _FLOAT8 | Array of double precision floats |
Boolean Type
PostgreSQL Type | Tacnode Type | Description |
---|---|---|
BOOL | BOOL | Boolean value |
_BOOL | _BOOL | Array of boolean values |
Date and Time Types
PostgreSQL Type | Tacnode Type | Description |
---|---|---|
DATE | DATE | Date without time |
_DATE | _DATE | Array of dates |
TIME | TIME | Time without timezone |
_TIME | _TIME | Array of times |
TIMETZ | TIMETZ | Time with timezone |
_TIMETZ | _TIMETZ | Array of times with timezone |
TIMESTAMP | TIMESTAMP | Date and time without timezone |
_TIMESTAMP | _TIMESTAMP | Array of timestamps |
TIMESTAMPTZ | TIMESTAMPTZ | Date and time with timezone |
_TIMESTAMPTZ | _TIMESTAMPTZ | Array of timestamps with timezone |
INTERVAL | INTERVAL | Time interval |
_INTERVAL | _INTERVAL | Array of intervals |
Binary and Bit Types
PostgreSQL Type | Tacnode Type | Description |
---|---|---|
BYTEA | BYTEA | Binary data |
_BYTEA | _BYTEA | Array of binary data |
BIT | BIT | Fixed-length bit string |
_BIT | _BIT | Array of bit strings |
VARBIT | VARBIT | Variable-length bit string |
_VARBIT | _VARBIT | Array of variable-length bit strings |
Special Types
PostgreSQL Type | Tacnode Type | Description |
---|---|---|
UUID | UUID | Universally unique identifier |
_UUID | _UUID | Array of UUIDs |
JSON | JSON | JSON data |
_JSON | _JSON | Array of JSON values |
JSONB | JSONB | Binary JSON data |
_JSONB | _JSONB | Array of binary JSON values |
XML | XML | XML data |
_XML | _XML | Array of XML values |
NAME | NAME | PostgreSQL name type |
NAME_ARRAY | NAME_ARRAY | Array of names |
Best Practices
Security
- Dedicated User: Use a dedicated user for synchronization with minimal required permissions
- Strong Passwords: Use strong, unique passwords for synchronization users
- Network Security: Use SSL/TLS encryption for connections when possible
Performance
- Publication Scope: Create publications for specific tables rather than all tables when possible
- Monitor WAL: Monitor WAL disk usage, especially during extended synchronization jobs
- Connection Pooling: Consider connection pooling for high-throughput scenarios
Maintenance
- Regular Monitoring: Monitor replication lag and synchronization health
- Publication Management: Keep publications up to date as schema changes occur
- User Management: Regularly review and rotate synchronization user credentials
Next Steps
After configuring your PostgreSQL data source:
- Test Connection: Verify connectivity using the Test Connection feature
- Select Objects: Choose which schemas and tables to synchronize
- Configure Mapping: Customize object and column mappings if needed
- Set Policies: Configure synchronization behavior and conflict resolution
- Monitor Job: Track synchronization progress and performance
For detailed steps on these configuration phases, refer to the Data Sync Quick Start guide.