- https://dev.mysql.com/doc/
- https://dev.mysql.com/doc/connector-j/8.0/en/
- https://dev.mysql.com/doc/refman/8.0/en/sql-syntax.html
- Parameterized SQL Execution: Executes an INSERT, UPDATE, or MERGE statement for each record.
- Kafka-to-MySQL Mapping: Supports extracting values from Kafka message fields and mapping them into SQL placeholders.
- Secure Connectivity: Handles credentials and secure access to on-prem or cloud-hosted MySQL databases.
- Data Durability: Stores transactional, analytical, or historical data reliably in relational storage.
- Data is consumed from the Kafka-native input topic.
- Each event is parsed into a record or key-value structure.
- The user-defined SQL query is executed with dynamic field substitution from the event data.
- The result is written to the specified MySQL database and table.
- Failures are logged, retried, or moved to dead-letter queues based on pipeline settings.
Field-by-Field Explanation
1. Title
- What It Is: Unique label for identifying the connector instance.
- Best Practice: Use names like
mysql-sales-log-writerormysql-realtime-inserts.
2. Host
- What It Is: Address of the MySQL server (public IP or internal hostname).
- Tip: For cloud MySQL services (for example, AWS RDS or Google Cloud SQL), use the service endpoint.
3. Port
- Default:
3306 - What It Is: Port used by the MySQL service. Custom ports may be used in secured deployments.
4. Database Name
- What It Is: The database where the SQL query will be executed.
- Note: The configured user must have access to this database and its target tables.
5. User
- What It Is: Username used to authenticate with the MySQL server.
- Permission Required: The user should have INSERT, UPDATE, or EXECUTE permissions on the relevant tables.
6. Password
- Description: Password associated with the MySQL user.
- Required: Only if MySQL authentication is enabled.
- Best Practice: Store credentials securely using a secrets manager or vault.
7. Query
- Purpose: SQL statement executed for every incoming message.
- Format: Can include parameter placeholders.
- Example:
- Data Mapping: Event fields are mapped to the query parameters.
8. Topic (Input)
- What It Is: Kafka-native topic from which Condense consumes messages.
- Example:
event.vehicle.realtime,alerts.device.health
- Cause: User does not have write permission on the target database or table.
- Fix: Grant INSERT, UPDATE, or appropriate execution privileges.
- Cause: Invalid SQL syntax or mismatch between query parameters and event fields.
- Fix: Validate the SQL statement and ensure the number of placeholders matches the mapped fields.
- Cause: Incoming messages do not contain all required fields.
- Fix: Add a preprocessing transform to populate the required fields before writing to MySQL.
- Cause: Incorrect host, port, or network connectivity issues.
- Fix: Verify connectivity between Condense and the MySQL server.
- Using prepared statements with placeholders improves performance and protects against SQL injection.
- Use
INSERT IGNOREorON DUPLICATE KEY UPDATEwhen duplicate events are possible.
- Future versions may support batched SQL execution for improved throughput.
- Changes to table schemas can impact connector execution. Coordinate schema updates with pipeline changes.
- Create a dedicated database user with only the required permissions.
- Add indexes on frequently queried columns such as timestamps or entity identifiers.
- Monitor connector logs and metrics for failed writes.
- Rotate database credentials regularly and manage them using a secrets manager.
- Keep SQL operations efficient and avoid unnecessarily large row payloads.