How to fix SQL error on on step #4

When trying to import step #4 (Categories), we are receiving the following SQL error:

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 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 'AND attribute_id = 61 AND store_id = 0 LIMIT 1' at line 1. The SQL statement executed was: SELECT * FROM `catalog_category_entity_datetime` `t` WHERE entity_id = AND attribute_id = 61 AND store_id = 0 LIMIT 1

This error also occurs when running step #4 from the command line interface.
When this step fails, the following step #5 for migrating Products says it completes… but no products are imported.

  1. Mall,Obviously this isn't going to work for us then. Since we are within the 7 day period, can you please issue a refund for the product and revoke the license as needed. Please reach out if there is some other process I need to go through to get a refund for the product.

5 answers

Profile photo of Mall Staff 184060.00 $tone February 7, 2018
Public

Hi there,

Also, it is worth mentioning that we are on the latest version of Magento 2 Enterprise Edition. Would this make a difference?

Yes, that is root of the issue as you mentioned. Please note that, our tool is compatible with Magento Community edition only.
We do state the Magento version that our tool supports in the product page here. For your convenience, I include below for your reference: 

The tool supports the following Magento versions:

  • Magento CE 1.x: 1.6.0.2 and later, 1.7.x, 1.8.x, 1.9.x

  • Magento CE 2.0.0 and later

Regards,
Mall.

#
Profile photo of Mall Staff 184060.00 $tone February 6, 2018
Public

Hi there,

When trying to import step #4 (Categories), we are receiving the following SQL error:

That is strange. Lets provide me the information about your instance:
+ Admin credentials and back-end url
+ SSH credentials and web root  path to your instance.
I will check further in your instance and reply you more later.
Regards,
Mall.
 

#1
Profile photo of planosynergyhosting 40.00 $tone February 6, 2018
Public

Hi Mall,
Unfortunately, we are testing this within a virtual machine using Vagrant on our local environments. I would be willing to screen share with you and grant you access via that method. Otherwise, I can try to provide you any debugging information you might need.
Thanks,
Chris

#2
Profile photo of Mall Staff 184060.00 $tone February 7, 2018
Public

Hi there,

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 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 ‘AND attribute_id = 61 AND store_id = 0 LIMIT 1’ at line 1. The SQL statement executed was: SELECT * FROM `catalog_category_entity_datetime` `t` WHERE entity_id = AND attribute_id = 61 AND store_id = 0 LIMIT 1

That is strange issue. Seem your M1’s database has some records which has bad data in the categories data section.
It’s hard to confirm on the root of that issue without having a closer checking into your instance.
As data migration might associate with complicated issues, please consider deploying a live staging instance for migration, and provide us credentials as my previous reply. All our users have been using this option which allows us to provide efficient assistance. 
Regards,
Mall.

#3
Profile photo of planosynergyhosting 40.00 $tone February 7, 2018
Public

Mall,

Trying to debug this since we do not currently have an environment outside of our local virtual machine and thought I would provide you with some more information.

Taking a look at _migrateCatalogCategories() in Step4Controller.php, we can see on line 224 that entity_id of $category2 is explicitly set to NULL. It is then passed to $this->_migrateCatalogCategoryEAV() as the second argument on line 263. 

In _migrateCatalogCategoryEAV(), $entityId2 (which is NULL) is used on line 325 in the SQL query $condition.

At what point should $category2->entity_id be set?
 

Also, it is worth mentioning that we are on the latest version of Magento 2 Enterprise Edition. Would this make a difference?

#4

Please login or Register to Submit Answer

Written By

Comments