Unable to import data from exported table. Error: Foreign key constraint is incorrectly formed

Every time I try to import data that I just recently exported I receive an email saying the import was unsuccessful. The table in question only has about 90 rows and I’ve changed the name, etc. to avoid colision. Here’s the log from the email:

04:38:05 IMPORT_DATA Importing Started.
04:38:06 IMPORT_DATA Importing failed. Exception:java.lang.RuntimeException: java.sql.SQLException: Can't create table `49259415-337F-9D60-FFEE-023C6FD21C00`.`28628B41-C261-CE50-FF11-3F7046EFC600.acl` (errno: 150 "Foreign key constraint is incorrectly formed")


com.backendless.services.persistence.schema.DatabaseOperation.logAndThrowRuntime(DatabaseOperation.java:268)
com.backendless.services.persistence.schema.DatabaseOperation.handleDdlException(DatabaseOperation.java:128)
com.backendless.services.persistence.schema.DatabaseOperation.doExecute(DatabaseOperation.java:117)
com.backendless.services.persistence.schema.DatabaseOperation.access$000(DatabaseOperation.java:33)
com.backendless.services.persistence.schema.DatabaseOperation$1.apply(DatabaseOperation.java:84)
com.backendless.services.persistence.schema.DatabaseOperation$1.apply(DatabaseOperation.java:80)
com.backendless.util.sync.RedisSync.execute(RedisSync.java:108)
com.backendless.util.SyncUtil.execute(SyncUtil.java:45)
com.backendless.services.persistence.schema.DatabaseOperation.execute(DatabaseOperation.java:88)
com.backendless.services.persistence.common.Schema.(Schema.java:47)
com.backendless.management.impex.manager.ImportDataManager.initTables(ImportDataManager.java:1176)
com.backendless.tasks.impex.ImportDataTask.executeImpl(ImportDataTask.java:161)
com.backendless.tasks.impex.AbstractImportTask.execute(AbstractImportTask.java:75)
com.backendless.taskman.Task.run(Task.java:123)
java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Can't create table `49259415-337F-9D60-FFEE-023C6FD21C00`.`28628B41-C261-CE50-FF11-3F7046EFC600.acl` (errno: 150 "Foreign key constraint is incorrectly formed")


com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3870)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3806)
com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2470)
com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2617)
com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2550)
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1192)
org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:198)
com.backendless.services.persistence.schema.SaveSchemaOperation.makeACL(SaveSchemaOperation.java:209)
com.backendless.services.persistence.schema.SaveSchemaOperation.after(SaveSchemaOperation.java:197)
com.backendless.services.persistence.schema.DatabaseOperation.doExecute(DatabaseOperation.java:112)
com.backendless.services.persistence.schema.DatabaseOperation.access$000(DatabaseOperation.java:33)
com.backendless.services.persistence.schema.DatabaseOperation$1.apply(DatabaseOperation.java:84)
com.backendless.services.persistence.schema.DatabaseOperation$1.apply(DatabaseOperation.java:80)
com.backendless.util.sync.RedisSync.execute(RedisSync.java:108)
com.backendless.util.SyncUtil.execute(SyncUtil.java:45)
com.backendless.services.persistence.schema.DatabaseOperation.execute(DatabaseOperation.java:88)
com.backendless.services.persistence.common.Schema.(Schema.java:47)
com.backendless.management.impex.manager.ImportDataManager.initTables(ImportDataManager.java:1176)
com.backendless.tasks.impex.ImportDataTask.executeImpl(ImportDataTask.java:161)
com.backendless.tasks.impex.AbstractImportTask.execute(AbstractImportTask.java:75)
com.backendless.taskman.Task.run(Task.java:123)
java.lang.Thread.run(Thread.java:745)
04:38:06 IMPORT_DATA Importing Finished.

I should note, I’m currently on the free plan–is this a feature limited to purchased plans?

Any help would be appreciated,
->Ben

Hi, Ben

Where do you try to import it? Because I have tried to import it to my new app and everything success http://take.ms/597IW

14:07:45 IMPORT_DATA Importing Started.
14:07:46 IMPORT_DATA Start import table: Artists
14:07:47 IMPORT_DATA Table ‘Artists’ was imported at 0 seconds
14:07:47 IMPORT_DATA Finish import table: Artists
14:07:47 IMPORT_DATA Start import table: Schedule
14:07:47 IMPORT_DATA Table ‘Schedule’ was imported at 0 seconds
14:07:47 IMPORT_DATA Finish import table: Schedule
14:07:47 IMPORT_DATA Importing Finished.

The app id is: 49259415-337F-9D60-FFEE-023C6FD21C00

It’s the exact same app the table was exported from with the filename changed so that it creates a new table. The table is created, but isn’t populated with data or a schema.

Do you import only the renamed CSV or all the files?

Just a single renamed CSV using the Data Service field, not a zip or multiple files.

Thanks. What is the name of the source table?

Source table is “Artists”

Screenshot: http://d.pr/i/Bm4Ma

I was able to reproduce the error. It appears there are some database problems at the lower level in the app. The best option would be to export data from Users, Artists and Schedule and re-import into a new app. Would this be an option for you?

Wouldn’t that break connectivity for the client in the existing version of the app?

I’m fine doing this if we can bring over existing users.

Yes, it would. I apologize, I saw only one registered user and assumed the app was still in development.

In this case, we will have to do some maintenance on the server side to get the database to work properly. We will update this topic as soon as possible.

Regards,
Mark

Hello, Ben

we have fixed the issue with your application, please check if everything works fine.

Yes. This worked. Thanks for the assistance!