Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escaped table name causes incorrect query generation for MySQL connector #82

Open
slvrtrn opened this issue Jul 14, 2021 · 0 comments
Open

Comments

@slvrtrn
Copy link

slvrtrn commented Jul 14, 2021

Given a simple table to test the things out

CREATE TABLE `users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` text NOT NULL,
  `registered_at` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  PRIMARY KEY (`id`)
) ENGINE = InnoDB;

and the following connector config

const mysqlConnectorConfig = {
  options: {
    host: env.DB_HOST,
    dialect: 'mysql',
    pool: {
      max: 5,
      min: 0,
      idle: 10000,
    },
  },
  database: env.DB_DATABASE,
  user: env.DB_USERNAME,
  password: env.DB_PASSWORD,
  maxPollCount: 100,
  incrementingColumnName: 'id',
  timestampColumnName: 'registered_at',
  fetchMode: 'timestamp',
  table: `users`,
  initTimestamp: env.KAFKA_CONNECT_USERS_INIT_TIMESTAMP,
};

the following error pops up in the console when the application and the polling are started:

Executing (default): SELECT * FROM 'users' ORDER BY 'id' LIMIT 100 OFFSET 0
[09:25:11.892] ERROR (SequelizeDatabaseError): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''users' ORDER BY 'id' LIMIT 100 OFFSET 0' at line 1
    SequelizeDatabaseError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''users' ORDER BY 'id' LIMIT 100 OFFSET 0' at line 1

this seems to be the culprit: https://github.com/nodefluent/sequelize-kafka-connect/blob/master/lib/source/SequelizeSourceTask.js#L41
as I remove the escaping here, that select works as expected without errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant