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

Issue in Exporting the data from MySQL with table_name including quotes #320

Open
priyanshi-yb opened this issue Sep 14, 2022 · 1 comment
Assignees

Comments

@priyanshi-yb
Copy link
Contributor

priyanshi-yb commented Sep 14, 2022

MySQL Database has these two tables -

MySQL [pk_missing]>show tables;
+----------------------+
| Tables_in_pk_missing |
+----------------------+
| "mock_data_COPY"     |
| MOCK_DATA            |
+----------------------+

Where "mock_data_COPY" is a copy of MOCK_DATA with same data but different name and name includes quotes.
I am trying to export the data from the MySQL database but it is throwing this error -

~/code/yb-voyager/yb-voyager/yb-voyager export data --export-dir /data/mysql-export-dir  --source-db-type ${SOURCE_DB_TYPE}  --source-db-host ${SOURCE_DB_HOST}       --source-db-user ${SOURCE_DB_USER}         --source-db-password ${SOURCE_DB_PASSWORD}        --source-db-name ${SOURCE_DB_NAME} --start-clean 
export of data for source type as 'mysql'
Num tables to export: 2
table list for data export: ["mock_data_COPY" MOCK_DATA]
calculating approx num of rows to export for each table...
Initiating data export.
Data export started.
Data export failed: exit status 255
DBD::mysql::st execute failed: Table 'pk_missing.mock_data_COPY' doesn't exist at /usr/local/share/perl5/Ora2Pg.pm line 14247.
DBD::mysql::st execute failed: Table 'pk_missing.mock_data_COPY' doesn't exist at /usr/local/share/perl5/Ora2Pg.pm line 14247.

Here, in this error - execute failed: Table 'pk_missing.mock_data_COPY' doesn't exist at /usr/local/share/perl5/Ora2Pg.pm line 14247. The pk_missing is the database name in MySQL and the mock_data_COPY is the table but it includes quotes as well.

Also, noticed in the tables.sql under schema folder, the DDL for this quoted table doesn't include quotes and is in lower case -

CREATE TABLE mock_data_copy (
   id serial,
   first_name varchar(50),
   last_name varchar(50),
   email varchar(50),
   gender varchar(50),
   ip_address varchar(20),
   PRIMARY KEY (id)
) ; 
@github-actions github-actions bot added the triage Needs to be triaged label Sep 14, 2022
@priyanshi-yb
Copy link
Contributor Author

There is a workaround for this issue to complete the migration-

  1. Rename the table-name of table with quotes to without quotes in MySQL Database using the command -

Alter table `"mock_data_COPY"` rename mock_data_COPY_quotes;

  1. Export and Import the data.
  2. Rename the table-name in YugabyteDB to quoted one using the command -

Alter table mock_data_copy_quotes rename to "mock_data_COPY";

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

3 participants