archi-contribs / database-plugin

Database export/import plugin that store models in a central database repository
Other
81 stars 23 forks source link

Exporting model to sqlite database using CLI results in empty model #175

Closed alf closed 4 months ago

alf commented 5 months ago

I would like to export an archi model to sqlite for further processing as part of my CI pipeline, unfortunately this doesn't seem to work as expected. Here's what I've tried.

Note that I use the following configuration in ~/.archi/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.archicontribs.database.prefs:

databases=1
databases_driver_0=sqlite
databases_name_0=export
databases_server_0=/tmp/export.sqlite
databases_views-images-border-width_0=10
databases_views-images-scale-factor_0=100
eclipse.preferences.version=1
loggerLevel=debug
loggerMode=simple
pluginVersion=4.9.7

If /tmp/export.sqlite does not exist I get a dialog telling me that the database does not exist and I have to confirm this. I can work around this by creating the empty database manually, but that's not really relevant for the problem here, so I click OK to proceed. Here's the resulting output. Notice how we export an empty model instead of the model I try to load using the modelrepository plugin.

Archi -application com.archimatetool.commandline.app -consoleLog -nosplash --abortOnException --modelrepository.loadModel . --export.database export
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.concurrent
2024-05-23 15:59:55 INFO   228:DBPlugin                                 - Logger initialised.
2024-05-23 15:59:55 INFO   229:DBPlugin                                 - Initialising Database import/export plugin v4.9.7 ...
2024-05-23 15:59:55 INFO   231:DBPlugin                                 - ===============================================
2024-05-23 15:59:55 DEBUG  252:DBPlugin                                 - Archi is setup with 16760 MB of memory.
2024-05-23 15:59:55 DEBUG  294:DBPlugin                                 - Plugin's package  = org.archicontribs.database
2024-05-23 15:59:55 DEBUG  295:DBPlugin                                 - Plugin's version  = 4.9.7
2024-05-23 15:59:55 DEBUG  296:DBPlugin                                 - Archi's version   = 5.0.0
2024-05-23 15:59:55 DEBUG  297:DBPlugin                                 - Plugin's folder   = /home/alf/.archi/dropins
2024-05-23 15:59:55 DEBUG  298:DBPlugin                                 - Plugin's filename = /home/alf/.archi/dropins/org.archicontribs.database_4.9.7.jar
[LoadModelFromRepositoryProvider] Loading model at .
2024-05-23 15:59:56 DEBUG   32:DBArchimateFactory                       - Initializing DBArchimateFactory
2024-05-23 15:59:56 DEBUG   71:DBArchimateModel                         - Creating new ArchimateModel
[LoadModelFromRepositoryProvider] Loaded model: 'Arkitektur Studieadministrasjon'
2024-05-23 15:59:56 DEBUG  228:DBGui                                    - Creating Form GUI.
2024-05-23 15:59:56 DEBUG  115:DBGuiExportModel                         - Setting up GUI for exporting model "Arkitektur Studieadministrasjon" (plugin version 4.9.7).
2024-05-23 15:59:56 DEBUG  356:DBDatabaseEntry                          - Getting databases preferences from preference store
2024-05-23 15:59:56 DEBUG  373:DBDatabaseEntry                          - Getting database entry "export" from the preference store
2024-05-23 15:59:56 INFO  1108:DBGui                                    - Connecting to the database ...
2024-05-23 15:59:56 DEBUG  701:DBGui                                    - Selected database = export (sqlite, /tmp/export.sqlite, 0, , 
2024-05-23 15:59:56 DEBUG  174:DBDatabaseConnection                     - Opening connection to database export: driver=sqlite, server=/tmp/export.sqlite, port=0, database=, schema=, username=
2024-05-23 15:59:56 DEBUG  177:DBDatabaseConnection                     - JDBC class = org.sqlite.JDBC
2024-05-23 15:59:56 DEBUG  180:DBDatabaseConnection                     - JDBC connection string = jdbc:sqlite:/tmp/export.sqlite
2024-05-23 15:59:56 DEBUG  223:DBDatabaseConnection                     - Connecting with username = 
2024-05-23 15:59:57 DEBUG  243:DBDatabaseConnection                     - Will use default schema 
2024-05-23 15:59:57 DEBUG  707:DBGui                                    - We are connected to the database.
2024-05-23 15:59:57 DEBUG  230:DBGuiUtils                               ┌ Question: We successfully connected to the database but it seems that it has not been initialized.
2024-05-23 15:59:57 DEBUG  230:DBGuiUtils                               │ 
2024-05-23 15:59:57 DEBUG  230:DBGuiUtils                               └ Do you wish to intialize the database ?
2024-05-23 15:59:58 DEBUG  258:DBGuiUtils                               - Answer: Yes
2024-05-23 15:59:58 INFO    71:DBGuiUtils                               - Creating necessary database tables ...
2024-05-23 15:59:59 DEBUG 1451:DBDatabaseConnection                     - Setting database auto commit to false
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table database_version
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table models
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table folders
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table folders_in_model
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table elements
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table elements_in_model
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table relationships
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table relationships_in_model
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table views
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table views_in_model
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table views_objects
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table views_objects_in_view
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table views_connections
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table views_connections_in_view
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table properties
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table features
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table profiles
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table profiles_in_model
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table bendpoints
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table metadata
2024-05-23 15:59:59 DEBUG  525:DBDatabaseConnection                     - Creating table images
2024-05-23 15:59:59 DEBUG 1460:DBDatabaseConnection                     - Committing database transaction.
2024-05-23 15:59:59 DEBUG 1451:DBDatabaseConnection                     - Setting database auto commit to true
2024-05-23 15:59:59 DEBUG  160:DBGuiUtils                               - INFO: The database has been successfully initialized.
2024-05-23 16:00:00 DEBUG 1301:DBGuiExportModel                         - Enabling the "Export" button.
2024-05-23 16:00:00 INFO  1967:DBGuiExportModel                         - Exporting model: 
2024-05-23 16:00:00 INFO  1995:DBGuiExportModel                         - Calculating model's checksum.
2024-05-23 16:00:00 INFO   988:DBGui                                    - Comparing the model to the database ...
2024-05-23 16:00:00 DEBUG  133:DBDatabaseExportConnection               - Getting versions of the model from the database
2024-05-23 16:00:00 DEBUG  157:DBDatabaseExportConnection               - The model does not exist in the database
2024-05-23 16:00:00 DEBUG  563:DBDatabaseExportConnection               - Getting versions of the profiles from the database
2024-05-23 16:00:00 DEBUG  671:DBDatabaseExportConnection               - Getting versions of the elements from the database
2024-05-23 16:00:00 DEBUG  794:DBDatabaseExportConnection               - Getting versions of the relationships from the database
2024-05-23 16:00:00 DEBUG  903:DBDatabaseExportConnection               - Getting versions of the folders from the database
2024-05-23 16:00:00 DEBUG 1012:DBDatabaseExportConnection               - Getting versions of the views from the database
2024-05-23 16:00:00 DEBUG 1122:DBDatabaseExportConnection               - Checking missing images from the database
2024-05-23 16:00:00 DEBUG 1195:DBDatabaseExportConnection               - Checking if the images exist in the database
2024-05-23 16:00:00 INFO   988:DBGui                                    - Checking if view screenshots are required
2024-05-23 16:00:00 INFO  1108:DBGui                                    - Calculating number of new, updated and deleted components.
2024-05-23 16:00:00 INFO  1955:DBGuiExportModel                         - The model needs to be exported to the database.
2024-05-23 16:00:00 INFO  1108:DBGui                                    - Checking for conflicts ...
2024-05-23 16:00:00 INFO  1108:DBGui                                    - Removing from the model the components that have been deleted in the database ...
2024-05-23 16:00:00 INFO  2253:DBGuiExportModel                         - There is no component to import from the database.
2024-05-23 16:00:00 INFO  1108:DBGui                                    - Checking if components have been moved to new folder ...
2024-05-23 16:00:00 INFO  2541:DBGuiExportModel                         - There is no component to move to a new folder.
2024-05-23 16:00:00 INFO   988:DBGui                                    - Exporting model to the database ...
2024-05-23 16:00:00 DEBUG 1451:DBDatabaseConnection                     - Setting database auto commit to false
2024-05-23 16:00:00 INFO  2576:DBGuiExportModel                         - Exporting the model itself ...
2024-05-23 16:00:00 DEBUG 1421:DBDatabaseExportConnection               - Exporting model (initial version = 0, exported version = 1, latest database version = 0)
2024-05-23 16:00:00 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting specializations ..."
2024-05-23 16:00:00 DEBUG 2109:DBDatabaseExportConnection               - Exporting Profile:"Modul"(id-97daed04442e40d1a0077dc1866a365a) (initial version = 0, exported version = 1, database_version = 0, latest_database_version = 0)
2024-05-23 16:00:00 DEBUG 2109:DBDatabaseExportConnection               - Exporting Profile:"Schema"(id-a9dfee63c9f64fc7bf954f51ffe899f2) (initial version = 0, exported version = 1, database_version = 0, latest_database_version = 0)
2024-05-23 16:00:00 DEBUG 2109:DBDatabaseExportConnection               - Exporting Profile:"Database"(id-2fa74595f41a4b79b583c33ec4f3bcf5) (initial version = 0, exported version = 1, database_version = 0, latest_database_version = 0)
2024-05-23 16:00:00 DEBUG 2109:DBDatabaseExportConnection               - Exporting Profile:"Team"(id-028a26da878b4bf9844543b5ffaa9281) (initial version = 0, exported version = 1, database_version = 0, latest_database_version = 0)
2024-05-23 16:00:00 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting elements ..."
2024-05-23 16:00:00 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting relationships ..."
2024-05-23 16:00:00 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting folders ..."
2024-05-23 16:00:00 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting views ..."
2024-05-23 16:00:00 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting view objects ..."
2024-05-23 16:00:00 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting view connections ..."
2024-05-23 16:00:00 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting images ..."
2024-05-23 16:00:00 DEBUG 1460:DBDatabaseConnection                     - Committing database transaction.
2024-05-23 16:00:01 DEBUG  260:DBDatabaseConnection                     - Closing the database connection.
2024-05-23 16:00:01 DEBUG 2961:DBGuiExportModel                         - Copying current version to initial version.
2024-05-23 16:00:01 DEBUG 3234:DBGuiExportModel                         - Showing result.
2024-05-23 16:00:01 INFO  3243:DBGuiExportModel                         -                             <------ In model ------>   <----- In database ---->
2024-05-23 16:00:01 INFO  3244:DBGuiExportModel                         -                     Total      New  Updated  Deleted      New  Updated  Deleted Conflict
2024-05-23 16:00:01 INFO  3245:DBGuiExportModel                         -    Elements:            0        0        0        0        0        0        0        0
2024-05-23 16:00:01 INFO  3246:DBGuiExportModel                         -    Relationships:       0        0        0        0        0        0        0        0
2024-05-23 16:00:01 INFO  3248:DBGuiExportModel                         -    Folders:             0        0        0        0        0        0        0        0
2024-05-23 16:00:01 INFO  3249:DBGuiExportModel                         -    views:               0        0        0        0        0        0        0        0
2024-05-23 16:00:01 INFO  3250:DBGuiExportModel                         -    Objects:             0        0        0        0        0        0        0        0
2024-05-23 16:00:01 INFO  3251:DBGuiExportModel                         -    Connections:         0        0        0        0        0        0        0        0
2024-05-23 16:00:01 INFO  3252:DBGuiExportModel                         -    images:              0        0                          0
2024-05-23 16:00:01 INFO  1108:DBGui                                    - *** Export successful ***
DBPlugin Export CommandLine DBPlugin Export CommandLine: The model "Arkitektur Studieadministrasjon" has been exported to the "export" database.

The problem here is that the model I want to load and export (Arkitektur Studieadministrasjon) contains hundreds of elements, relationships etc. I get the feeling that there is a race condition here where the database export runs before the model I want to export gets loaded. Thus an empty model is created and exported instead. Loading the model using --loadModel also result in an empty model.

If I try to do another export without first deleting the sqlite file it fails with a different message. That's a different bug I suspect, but here's the output in case it helps:

Archi -application com.archimatetool.commandline.app     -consoleLog -nosplash --abortOnException --modelrepository.loadModel . --export.database export
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.concurrent
2024-05-23 16:07:37 INFO   228:DBPlugin                                 - Logger initialised.
2024-05-23 16:07:37 INFO   229:DBPlugin                                 - Initialising Database import/export plugin v4.9.7 ...
2024-05-23 16:07:37 INFO   231:DBPlugin                                 - ===============================================
2024-05-23 16:07:37 DEBUG  252:DBPlugin                                 - Archi is setup with 16760 MB of memory.
2024-05-23 16:07:37 DEBUG  294:DBPlugin                                 - Plugin's package  = org.archicontribs.database
2024-05-23 16:07:37 DEBUG  295:DBPlugin                                 - Plugin's version  = 4.9.7
2024-05-23 16:07:37 DEBUG  296:DBPlugin                                 - Archi's version   = 5.0.0
2024-05-23 16:07:37 DEBUG  297:DBPlugin                                 - Plugin's folder   = /home/alf/.archi/dropins
2024-05-23 16:07:37 DEBUG  298:DBPlugin                                 - Plugin's filename = /home/alf/.archi/dropins/org.archicontribs.database_4.9.7.jar
[LoadModelFromRepositoryProvider] Loading model at .
2024-05-23 16:07:37 DEBUG   32:DBArchimateFactory                       - Initializing DBArchimateFactory
2024-05-23 16:07:37 DEBUG   71:DBArchimateModel                         - Creating new ArchimateModel
[LoadModelFromRepositoryProvider] Loaded model: 'Arkitektur Studieadministrasjon'
2024-05-23 16:07:38 DEBUG  228:DBGui                                    - Creating Form GUI.
2024-05-23 16:07:38 DEBUG  115:DBGuiExportModel                         - Setting up GUI for exporting model "Arkitektur Studieadministrasjon" (plugin version 4.9.7).
2024-05-23 16:07:38 DEBUG  356:DBDatabaseEntry                          - Getting databases preferences from preference store
2024-05-23 16:07:38 DEBUG  373:DBDatabaseEntry                          - Getting database entry "export" from the preference store
2024-05-23 16:07:38 INFO  1108:DBGui                                    - Connecting to the database ...
2024-05-23 16:07:38 DEBUG  701:DBGui                                    - Selected database = export (sqlite, /tmp/export.sqlite, 0, , 
2024-05-23 16:07:38 DEBUG  174:DBDatabaseConnection                     - Opening connection to database export: driver=sqlite, server=/tmp/export.sqlite, port=0, database=, schema=, username=
2024-05-23 16:07:38 DEBUG  177:DBDatabaseConnection                     - JDBC class = org.sqlite.JDBC
2024-05-23 16:07:38 DEBUG  180:DBDatabaseConnection                     - JDBC connection string = jdbc:sqlite:/tmp/export.sqlite
2024-05-23 16:07:38 DEBUG  223:DBDatabaseConnection                     - Connecting with username = 
2024-05-23 16:07:38 DEBUG  243:DBDatabaseConnection                     - Will use default schema 
2024-05-23 16:07:38 DEBUG  707:DBGui                                    - We are connected to the database.
2024-05-23 16:07:38 DEBUG 1301:DBGuiExportModel                         - Enabling the "Export" button.
2024-05-23 16:07:38 INFO  1967:DBGuiExportModel                         - Exporting model: 
2024-05-23 16:07:38 INFO  1995:DBGuiExportModel                         - Calculating model's checksum.
2024-05-23 16:07:38 INFO   988:DBGui                                    - Comparing the model to the database ...
2024-05-23 16:07:38 DEBUG  133:DBDatabaseExportConnection               - Getting versions of the model from the database
2024-05-23 16:07:38 DEBUG  153:DBDatabaseExportConnection               - The model already exists in the database:
2024-05-23 16:07:38 DEBUG  563:DBDatabaseExportConnection               - Getting versions of the profiles from the database
2024-05-23 16:07:38 DEBUG  671:DBDatabaseExportConnection               - Getting versions of the elements from the database
2024-05-23 16:07:38 DEBUG  794:DBDatabaseExportConnection               - Getting versions of the relationships from the database
2024-05-23 16:07:38 DEBUG  903:DBDatabaseExportConnection               - Getting versions of the folders from the database
2024-05-23 16:07:38 DEBUG 1012:DBDatabaseExportConnection               - Getting versions of the views from the database
2024-05-23 16:07:38 DEBUG 1122:DBDatabaseExportConnection               - Checking missing images from the database
2024-05-23 16:07:38 DEBUG 1195:DBDatabaseExportConnection               - Checking if the images exist in the database
2024-05-23 16:07:38 INFO   988:DBGui                                    - Checking if view screenshots are required
2024-05-23 16:07:38 INFO  1108:DBGui                                    - Calculating number of new, updated and deleted components.
2024-05-23 16:07:38 INFO  1955:DBGuiExportModel                         - The model needs to be exported to the database.
2024-05-23 16:07:38 INFO  1108:DBGui                                    - Checking for conflicts ...
2024-05-23 16:07:38 INFO  1108:DBGui                                    - Removing from the model the components that have been deleted in the database ...
2024-05-23 16:07:38 INFO  2253:DBGuiExportModel                         - There is no component to import from the database.
2024-05-23 16:07:38 INFO  1108:DBGui                                    - Checking if components have been moved to new folder ...
2024-05-23 16:07:38 INFO  2541:DBGuiExportModel                         - There is no component to move to a new folder.
2024-05-23 16:07:38 INFO   988:DBGui                                    - Exporting model to the database ...
2024-05-23 16:07:38 DEBUG 1451:DBDatabaseConnection                     - Setting database auto commit to false
2024-05-23 16:07:38 INFO  2576:DBGuiExportModel                         - Exporting the model itself ...
2024-05-23 16:07:38 DEBUG 1421:DBDatabaseExportConnection               - Exporting model (initial version = 0, exported version = 2, latest database version = 1)
2024-05-23 16:07:38 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting specializations ..."
2024-05-23 16:07:38 DEBUG 2109:DBDatabaseExportConnection               - Exporting Profile:"Modul"(id-97daed04442e40d1a0077dc1866a365a) (initial version = 0, exported version = 1, database_version = 0, latest_database_version = 0)
2024-05-23 16:07:38 DEBUG 1476:DBDatabaseConnection                     - Rollbacking database transaction.
2024-05-23 16:07:38 DEBUG  260:DBDatabaseConnection                     - Closing the database connection.
2024-05-23 16:07:38 DEBUG 3234:DBGuiExportModel                         - Showing result.
2024-05-23 16:07:38 ERROR 1106:DBGui                                    ┌ Failed to export the model to the database
2024-05-23 16:07:38 ERROR 1106:DBGui                                    └ [SQLITE_CONSTRAINT_PRIMARYKEY] A PRIMARY KEY constraint failed (UNIQUE constraint failed: profiles.id, profiles.version)
2024-05-23 16:07:38 DEBUG  160:DBGuiUtils                               ┌ ERROR: Failed to export the model to the database
2024-05-23 16:07:38 DEBUG  160:DBGuiUtils                               │ 
2024-05-23 16:07:38 DEBUG  160:DBGuiUtils                               └ The transaction has been rolled back to leave the database in a coherent state. You may solve the issue and export again your components.
org.sqlite.SQLiteException: [SQLITE_CONSTRAINT_PRIMARYKEY] A PRIMARY KEY constraint failed (UNIQUE constraint failed: profiles.id, profiles.version)
        at org.sqlite.core.DB.newSQLException(DB.java:1135)
        at org.sqlite.core.DB.newSQLException(DB.java:1146)
        at org.sqlite.core.DB.execute(DB.java:941)
        at org.sqlite.core.DB.executeUpdate(DB.java:1010)
        at org.sqlite.jdbc3.JDBC3PreparedStatement.lambda$executeLargeUpdate$2(JDBC3PreparedStatement.java:117)
        at org.sqlite.jdbc3.JDBC3Statement.withConnectionTimeout(JDBC3Statement.java:429)
        at org.sqlite.jdbc3.JDBC3PreparedStatement.executeLargeUpdate(JDBC3PreparedStatement.java:116)
        at org.sqlite.jdbc3.JDBC3PreparedStatement.executeUpdate(JDBC3PreparedStatement.java:98)
        at org.archicontribs.database.connection.DBStatement.executeUpdate(DBStatement.java:78)
        at org.archicontribs.database.connection.DBRequest.<init>(DBRequest.java:23)
        at org.archicontribs.database.connection.DBDatabaseConnection.insert(DBDatabaseConnection.java:1357)
        at org.archicontribs.database.connection.DBDatabaseExportConnection.exportProfile(DBDatabaseExportConnection.java:2123)
        at org.archicontribs.database.connection.DBDatabaseExportConnection.exportEObject(DBDatabaseExportConnection.java:1467)
        at org.archicontribs.database.GUI.DBGuiExportModel.export(DBGuiExportModel.java:2597)
        at org.archicontribs.database.commandline.DBExportModelProvider.run(DBExportModelProvider.java:69)
        at com.archimatetool.commandline.CentralScrutinizer.runProviderOptions(CentralScrutinizer.java:164)
        at com.archimatetool.commandline.CentralScrutinizer.start(CentralScrutinizer.java:82)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:578)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
DBPlugin Export CommandLine DBPlugin Export CommandLine: Failed to export the model "Arkitektur Studieadministrasjon" to the "export" database.

If I use the export GUI this problem does not exist.

herve91 commented 5 months ago

That's stange, if the file does not exist, it is supposed to create it befor asking you if you wish to initialize it with the required tables. Nevertheless, you're right, this is not relevant to your key issue.

On the first log, I'm puzzled as the number of componets exported is zero everywhere. On an empty model, you should definitively have the default Archi components, so you should have


2024-05-23 22:14:09 INFO  3251:DBGuiExportModel                         -                             <------ In model ------>   <----- In database ---->
2024-05-23 22:14:09 INFO  3252:DBGuiExportModel                         -                     Total      New  Updated  Deleted      New  Updated  Deleted Conflict
2024-05-23 22:14:09 INFO  3253:DBGuiExportModel                         -    Elements:            0        0        0        0        0        0        0        0
2024-05-23 22:14:09 INFO  3254:DBGuiExportModel                         -    Relationships:       0        0        0        0        0        0        0        0
2024-05-23 22:14:09 INFO  3256:DBGuiExportModel                         -    Folders:             9        9        0        0        0        0        0        0
2024-05-23 22:14:09 INFO  3257:DBGuiExportModel                         -    views:               1        1        0        0        0        0        0        0
2024-05-23 22:14:09 INFO  3258:DBGuiExportModel                         -    Objects:             0        0        0        0        0        0        0        0
2024-05-23 22:14:09 INFO  3259:DBGuiExportModel                         -    Connections:         0        0        0        0        0        0        0        0
2024-05-23 22:14:09 INFO  3260:DBGuiExportModel                         -    images:              0        0                          0
2024-05-23 22:14:09 INFO  1113:DBGui                                    - *** Export successful ***`

Regarding the id constraint on the profiles table, I need to do more testing, I do not use specializations so much.

I add it to the list of things to do
alf commented 5 months ago

Based on your reply I assume you’re not able to reproduce?

Is there anything I can do to help narrow things down further?

herve91 commented 5 months ago

Effectively, I failed to reproduct it.

As a start, please provide me with the log of an empty model export with the logger configured in trace mode with the sql requests. I first need to understand why the export states nothing is exported to your database and still says the export is successful.

You may as well manually connect to your sqlite database and check if the tables are empty or not.

alf commented 5 months ago

I created a new model and saved as empty.archimate, then tried to export it after deleting the previous sqlite file. This time with trace logging. The command I used to export was: Archi -application com.archimatetool.commandline.app -consoleLog -nosplash --abortOnException --export.database export --loadModel empty.archimate > out.log

2024-05-24 08:50:31 INFO   228:DBPlugin                                 - Logger initialised.
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 ┌    log4j.rootLogger = TRACE, stdout, file   log4j.appender.stdout = org.apache.log4j.ConsoleAppender
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 │    log4j.appender.stdout.Target = System.out
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 │    log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 │    log4j.appender.stdout.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %4L:%-40.40C{1} %m%n
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 │    log4j.appender.file = org.apache.log4j.FileAppender
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 │    log4j.appender.file.ImmediateFlush = true
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 │    log4j.appender.file.Append = false
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 │    log4j.appender.file.Encoding = UTF-8
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 │    log4j.appender.file.File = /home/alf/DatabasePlugin.log
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 │    log4j.appender.file.layout = org.apache.log4j.PatternLayout
2024-05-24 08:50:31 TRACE  228:DBPlugin                                 └    log4j.appender.file.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %4L:%-40.40C{1} %m%n
2024-05-24 08:50:31 INFO   229:DBPlugin                                 - Initialising Database import/export plugin v4.9.7 ...
2024-05-24 08:50:31 INFO   231:DBPlugin                                 - ===============================================
2024-05-24 08:50:31 DEBUG  252:DBPlugin                                 - Archi is setup with 16760 MB of memory.
2024-05-24 08:50:31 DEBUG  294:DBPlugin                                 - Plugin's package  = org.archicontribs.database
2024-05-24 08:50:31 DEBUG  295:DBPlugin                                 - Plugin's version  = 4.9.7
2024-05-24 08:50:31 DEBUG  296:DBPlugin                                 - Archi's version   = 5.0.0
2024-05-24 08:50:31 DEBUG  297:DBPlugin                                 - Plugin's folder   = /home/alf/.archi/dropins
2024-05-24 08:50:31 DEBUG  298:DBPlugin                                 - Plugin's filename = /home/alf/.archi/dropins/org.archicontribs.database_4.9.7.jar
2024-05-24 08:50:31 DEBUG   32:DBArchimateFactory                       - Initializing DBArchimateFactory
2024-05-24 08:50:31 DEBUG   71:DBArchimateModel                         - Creating new ArchimateModel
[Core] Loaded model: '(new model)'
2024-05-24 08:50:31 DEBUG  228:DBGui                                    - Creating Form GUI.
2024-05-24 08:50:31 DEBUG  115:DBGuiExportModel                         - Setting up GUI for exporting model "(new model)" (plugin version 4.9.7).
2024-05-24 08:50:31 DEBUG  356:DBDatabaseEntry                          - Getting databases preferences from preference store
2024-05-24 08:50:31 DEBUG  373:DBDatabaseEntry                          - Getting database entry "export" from the preference store
2024-05-24 08:50:31 INFO  1108:DBGui                                    - Connecting to the database ...
2024-05-24 08:50:31 DEBUG  701:DBGui                                    - Selected database = export (sqlite, /tmp/export.sqlite, 0, , 
2024-05-24 08:50:31 DEBUG  174:DBDatabaseConnection                     - Opening connection to database export: driver=sqlite, server=/tmp/export.sqlite, port=0, database=, schema=, username=
2024-05-24 08:50:31 DEBUG  177:DBDatabaseConnection                     - JDBC class = org.sqlite.JDBC
2024-05-24 08:50:31 DEBUG  180:DBDatabaseConnection                     - JDBC connection string = jdbc:sqlite:/tmp/export.sqlite
2024-05-24 08:50:31 DEBUG  223:DBDatabaseConnection                     - Connecting with username = 
2024-05-24 08:50:31 DEBUG  243:DBDatabaseConnection                     - Will use default schema 
2024-05-24 08:50:31 DEBUG  707:DBGui                                    - We are connected to the database.
2024-05-24 08:50:31 TRACE  300:DBDatabaseConnection                     - Checking "database_version" table
2024-05-24 08:50:31 TRACE   44:DBStatement                              - SQL Exception for database request: SELECT version FROM database_version WHERE archi_plugin = ?
2024-05-24 08:50:31 DEBUG  230:DBGuiUtils                               ┌ Question: We successfully connected to the database but it seems that it has not been initialized.
2024-05-24 08:50:31 DEBUG  230:DBGuiUtils                               │ 
2024-05-24 08:50:31 DEBUG  230:DBGuiUtils                               └ Do you wish to intialize the database ?
2024-05-24 08:50:33 DEBUG  258:DBGuiUtils                               - Answer: Yes
2024-05-24 08:50:33 INFO    71:DBGuiUtils                               - Creating necessary database tables ...
2024-05-24 08:50:33 DEBUG 1451:DBDatabaseConnection                     - Setting database auto commit to false
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table database_version
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE database_version (id VARCHAR(50) NOT NULL, archi_plugin VARCHAR(50) NOT NULL, version INTEGER(10) NOT NULL)
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table models
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE models (id VARCHAR(50) NOT NULL, version INTEGER(10) NOT NULL, name VARCHAR(1024) NOT NULL, note CLOB, purpose CLOB, created_by VARCHAR(30) NOT NULL, created_on TIMESTAMP NOT NULL, checkedin_by VARCHAR(30), checkedin_on TIMESTAMP, deleted_by VARCHAR(30), deleted_on TIMESTAMP, properties INTEGER(10), features INTEGER(10), checksum VARCHAR(50) NOT NULL, PRIMARY KEY (id, version))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table folders
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE folders (id VARCHAR(50) NOT NULL, version INTEGER(10) NOT NULL, type INTEGER(10) NOT NULL, root_type INTEGER(10) NOT NULL, name VARCHAR(1024) NOT NULL, documentation CLOB, created_by VARCHAR(30) NOT NULL, created_on TIMESTAMP NOT NULL, checkedin_by VARCHAR(30), checkedin_on TIMESTAMP, deleted_by VARCHAR(30), deleted_on TIMESTAMP, properties INTEGER(10), features INTEGER(10), checksum VARCHAR(50) NOT NULL, PRIMARY KEY (id, version))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table folders_in_model
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE folders_in_model (fim_id INTEGER NOT NULL, folder_id VARCHAR(50) NOT NULL, folder_version INTEGER(10) NOT NULL, parent_folder_id VARCHAR(50), model_id VARCHAR(50) NOT NULL, model_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, PRIMARY KEY (fim_id))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table elements
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE elements (id VARCHAR(50) NOT NULL, version INTEGER(10) NOT NULL, class VARCHAR(50) NOT NULL, name VARCHAR(1024), documentation CLOB, type VARCHAR(3), profile VARCHAR(50), created_by VARCHAR(30) NOT NULL, created_on TIMESTAMP NOT NULL, checkedin_by VARCHAR(30), checkedin_on TIMESTAMP, deleted_by VARCHAR(30), deleted_on TIMESTAMP, properties INTEGER(10), features INTEGER(10), checksum VARCHAR(50) NOT NULL, PRIMARY KEY (id, version))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table elements_in_model
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE elements_in_model (eim_id INTEGER NOT NULL, element_id VARCHAR(50) NOT NULL, element_version INTEGER(10) NOT NULL, parent_folder_id VARCHAR(50) NOT NULL, model_id VARCHAR(50) NOT NULL, model_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, PRIMARY KEY (eim_id))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table relationships
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE relationships (id VARCHAR(50) NOT NULL, version INTEGER(10) NOT NULL, class VARCHAR(50) NOT NULL, name VARCHAR(1024), documentation CLOB, source_id VARCHAR(50), target_id VARCHAR(50), strength CLOB, access_type INTEGER(10), is_directed TINYINT, profile VARCHAR(50), created_by VARCHAR(30) NOT NULL, created_on TIMESTAMP NOT NULL, checkedin_by VARCHAR(30), checkedin_on TIMESTAMP, deleted_by VARCHAR(30), deleted_on TIMESTAMP, properties INTEGER(10), features INTEGER(10), checksum VARCHAR(50) NOT NULL, PRIMARY KEY (id, version))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table relationships_in_model
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE relationships_in_model (rim_id INTEGER NOT NULL, relationship_id VARCHAR(50) NOT NULL, relationship_version INTEGER(10) NOT NULL, parent_folder_id VARCHAR(50) NOT NULL, model_id VARCHAR(50) NOT NULL, model_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, PRIMARY KEY (rim_id))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table views
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE views (id VARCHAR(50) NOT NULL, version INTEGER(10) NOT NULL, class VARCHAR(50) NOT NULL, name VARCHAR(1024), documentation CLOB, background INTEGER(10), connection_router_type INTEGER(10) NOT NULL, viewpoint VARCHAR(50), screenshot BLOB, screenshot_scale_factor INTEGER(10), screenshot_border_width INTEGER(10), created_by VARCHAR(30) NOT NULL, created_on TIMESTAMP NOT NULL, checkedin_by VARCHAR(30), checkedin_on TIMESTAMP, deleted_by VARCHAR(30), deleted_on TIMESTAMP, properties INTEGER(10), features INTEGER(10), checksum VARCHAR(50) NOT NULL, container_checksum VARCHAR(50) NOT NULL, PRIMARY KEY (id, version))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table views_in_model
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE views_in_model (vim_id INTEGER NOT NULL, view_id VARCHAR(50) NOT NULL, view_version INTEGER(10) NOT NULL, parent_folder_id VARCHAR(50) NOT NULL, model_id VARCHAR(50) NOT NULL, model_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, PRIMARY KEY (vim_id))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table views_objects
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE views_objects (id VARCHAR(50) NOT NULL, version INTEGER(10) NOT NULL, class VARCHAR(50) NOT NULL, container_id VARCHAR(50) NOT NULL, element_id VARCHAR(50), element_version INTEGER(10), diagram_ref_id VARCHAR(50), border_color VARCHAR(7), border_type INTEGER(10), content CLOB, documentation CLOB, is_locked TINYINT, image_path VARCHAR(50), image_position INTEGER(10), line_color VARCHAR(7), line_width INTEGER(10), fill_color VARCHAR(7), alpha INTEGER(10), font VARCHAR(150), font_color VARCHAR(7), name VARCHAR(1024), notes CLOB, text_alignment INTEGER(10), text_position INTEGER(10), type INTEGER(10), x INTEGER(10), y INTEGER(10), width INTEGER(10), height INTEGER(10), created_by VARCHAR(30) NOT NULL, created_on TIMESTAMP NOT NULL, checkedin_by VARCHAR(30), checkedin_on TIMESTAMP, deleted_by VARCHAR(30), deleted_on TIMESTAMP, properties INTEGER(10), features INTEGER(10), checksum VARCHAR(50) NOT NULL, PRIMARY KEY (id, version))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table views_objects_in_view
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE views_objects_in_view (oiv_id INTEGER NOT NULL, object_id VARCHAR(50) NOT NULL, object_version INTEGER(10) NOT NULL, view_id VARCHAR(50) NOT NULL, view_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, PRIMARY KEY (oiv_id))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table views_connections
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE views_connections (id VARCHAR(50) NOT NULL, version INTEGER(10) NOT NULL, class VARCHAR(50) NOT NULL, container_id VARCHAR(50) NOT NULL, relationship_id VARCHAR(50), relationship_version INTEGER(10), source_object_id VARCHAR(50), target_object_id VARCHAR(50), name VARCHAR(1024), documentation CLOB, is_locked TINYINT, line_color VARCHAR(7), line_width INTEGER(10), font VARCHAR(150), font_color VARCHAR(7), text_position INTEGER(10), type INTEGER(10), created_by VARCHAR(30) NOT NULL, created_on TIMESTAMP NOT NULL, checkedin_by VARCHAR(30), checkedin_on TIMESTAMP, deleted_by VARCHAR(30), deleted_on TIMESTAMP, bendpoints INTEGER(10), properties INTEGER(10), features INTEGER(10), checksum VARCHAR(50) NOT NULL, PRIMARY KEY (id, version))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table views_connections_in_view
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE views_connections_in_view (civ_id INTEGER NOT NULL, connection_id VARCHAR(50) NOT NULL, connection_version INTEGER(10) NOT NULL, view_id VARCHAR(50) NOT NULL, view_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, PRIMARY KEY (civ_id))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table properties
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE properties (parent_id VARCHAR(50) NOT NULL, parent_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, name VARCHAR(1024), value CLOB, PRIMARY KEY (parent_id, parent_version, pos))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table features
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE features (parent_id VARCHAR(50) NOT NULL, parent_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, name VARCHAR(1024), value CLOB, PRIMARY KEY (parent_id, parent_version, pos))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table profiles
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE profiles (id VARCHAR(50) NOT NULL, version INTEGER(10) NOT NULL, name VARCHAR(1024), is_specialization TINYINT, image_path VARCHAR(50), concept_type VARCHAR(50), created_by VARCHAR(30) NOT NULL, created_on TIMESTAMP NOT NULL, checkedin_by VARCHAR(30), checkedin_on TIMESTAMP, deleted_by VARCHAR(30), deleted_on TIMESTAMP, checksum VARCHAR(50) NOT NULL, PRIMARY KEY (id, version))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table profiles_in_model
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE profiles_in_model (pim_id INTEGER NOT NULL, profile_id VARCHAR(50) NOT NULL, profile_version INTEGER(10) NOT NULL, model_id VARCHAR(50) NOT NULL, model_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, PRIMARY KEY (pim_id))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table bendpoints
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE bendpoints (parent_id VARCHAR(50) NOT NULL, parent_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, start_x INTEGER(10) NOT NULL, start_y INTEGER(10) NOT NULL, end_x INTEGER(10) NOT NULL, end_y INTEGER(10) NOT NULL, PRIMARY KEY (parent_id, parent_version, pos))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table metadata
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE metadata (parent_id VARCHAR(50) NOT NULL, parent_version INTEGER(10) NOT NULL, pos INTEGER(10) NOT NULL, name VARCHAR(1024), value CLOB, PRIMARY KEY (parent_id, parent_version, pos))
2024-05-24 08:50:33 DEBUG  525:DBDatabaseConnection                     - Creating table images
2024-05-24 08:50:33 TRACE   66:DBStatement                              -       --> CREATE TABLE images (path VARCHAR(50) NOT NULL, image BLOB NOT NULL)
2024-05-24 08:50:33 TRACE  170:DBStatement                              -       --> INSERT INTO database_version (id, archi_plugin, version) VALUES ('a65244ae-17ba-4550-b1d2-523fd8c6e94d', 'DatabasePlugin', 490)
2024-05-24 08:50:33 DEBUG 1460:DBDatabaseConnection                     - Committing database transaction.
2024-05-24 08:50:33 DEBUG 1451:DBDatabaseConnection                     - Setting database auto commit to true
2024-05-24 08:50:33 DEBUG  160:DBGuiUtils                               - INFO: The database has been successfully initialized.
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT version, created_by, created_on, name, note, purpose, checksum FROM models WHERE id = 'id-0b2343ffbb1e430d9227803fcce447a0' ORDER BY version DESC
2024-05-24 08:50:35 DEBUG 1301:DBGuiExportModel                         - Enabling the "Export" button.
2024-05-24 08:50:35 INFO  1967:DBGuiExportModel                         - Exporting model: 
2024-05-24 08:50:35 INFO  1995:DBGuiExportModel                         - Calculating model's checksum.
2024-05-24 08:50:35 INFO   988:DBGui                                    - Comparing the model to the database ...
2024-05-24 08:50:35 DEBUG  133:DBDatabaseExportConnection               - Getting versions of the model from the database
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT version, checksum, created_on FROM models WHERE id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND version = (SELECT MAX(version) FROM models WHERE id = 'id-0b2343ffbb1e430d9227803fcce447a0')
2024-05-24 08:50:35 DEBUG  157:DBDatabaseExportConnection               - The model does not exist in the database
2024-05-24 08:50:35 TRACE  163:DBDatabaseExportConnection               -          Initial version = 0
2024-05-24 08:50:35 TRACE  164:DBDatabaseExportConnection               -          Current version = 0
2024-05-24 08:50:35 TRACE  165:DBDatabaseExportConnection               -          Database version = 0
2024-05-24 08:50:35 DEBUG  563:DBDatabaseExportConnection               - Getting versions of the profiles from the database
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT id, name, version, checksum, created_on, created_by, model_id, model_version, pos FROM profiles LEFT JOIN profiles_in_model ON profile_id = id AND profile_version = version WHERE id IN (SELECT id FROM profiles JOIN profiles_in_model ON profile_id = id AND profile_version = version WHERE model_id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND model_version = 0) ORDER BY id, version, model_version
2024-05-24 08:50:35 DEBUG  671:DBDatabaseExportConnection               - Getting versions of the elements from the database
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT id, name, version, checksum, created_on, created_by, model_id, model_version FROM elements LEFT JOIN elements_in_model ON element_id = id AND element_version = version WHERE id IN (SELECT id FROM elements JOIN elements_in_model ON element_id = id AND element_version = version WHERE model_id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND model_version = 0) ORDER BY id, version, model_version
2024-05-24 08:50:35 DEBUG  794:DBDatabaseExportConnection               - Getting versions of the relationships from the database
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT id, name, version, checksum, created_on, created_by, model_id, model_version FROM relationships LEFT JOIN relationships_in_model ON relationship_id = id AND relationship_version = version WHERE id IN (SELECT id FROM relationships JOIN relationships_in_model ON relationship_id = id AND relationship_version = version WHERE model_id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND model_version = 0) ORDER BY id, version, model_version
2024-05-24 08:50:35 DEBUG  903:DBDatabaseExportConnection               - Getting versions of the folders from the database
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT id, name, version, checksum, created_on, created_by, model_id, model_version FROM folders LEFT JOIN folders_in_model ON folder_id = id AND folder_version = version WHERE id IN (SELECT id FROM folders JOIN folders_in_model ON folder_id = id AND folder_version = version WHERE model_id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND model_version = 0) ORDER BY id, version, model_version
2024-05-24 08:50:35 DEBUG 1012:DBDatabaseExportConnection               - Getting versions of the views from the database
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT id, name, version, checksum, container_checksum, created_on, created_by, model_id, model_version FROM views LEFT JOIN views_in_model ON view_id = id AND view_version = version WHERE id IN (SELECT id FROM views JOIN views_in_model ON view_id = id AND view_version = version WHERE model_id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND model_version = 0) ORDER BY id, version, model_version
2024-05-24 08:50:35 DEBUG 1122:DBDatabaseExportConnection               - Checking missing images from the database
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT DISTINCT image_path FROM views_objects JOIN views_objects_in_view ON views_objects_in_view.object_id = views_objects.id AND views_objects_in_view.object_version = views_objects.version JOIN views_in_model ON views_in_model.view_id = views_objects_in_view.view_id AND views_in_model.view_version = views_objects_in_view.view_version WHERE image_path IS NOT NULL AND views_in_model.model_id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND views_in_model.model_version = 0
2024-05-24 08:50:35 DEBUG 1195:DBDatabaseExportConnection               - Checking if the images exist in the database
2024-05-24 08:50:35 INFO   988:DBGui                                    - Checking if view screenshots are required
2024-05-24 08:50:35 INFO  1108:DBGui                                    - Calculating number of new, updated and deleted components.
2024-05-24 08:50:35 INFO  1955:DBGuiExportModel                         - The model needs to be exported to the database.
2024-05-24 08:50:35 INFO  1108:DBGui                                    - Checking for conflicts ...
2024-05-24 08:50:35 INFO  1108:DBGui                                    - Removing from the model the components that have been deleted in the database ...
2024-05-24 08:50:35 INFO  2253:DBGuiExportModel                         - There is no component to import from the database.
2024-05-24 08:50:35 INFO  1108:DBGui                                    - Checking if components have been moved to new folder ...
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT m2.element_id AS element_id, m2.parent_folder_id AS parent_folder_id FROM elements_in_model m1 JOIN elements_in_model m2 ON m1.element_id = m2.element_id AND m1.model_id = m2.model_id WHERE m1.model_id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND m1.model_version = 0 AND m2.model_version = 0 AND m1.parent_folder_id <> m2.parent_folder_id
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT m2.relationship_id AS relationship_id, m2.parent_folder_id AS parent_folder_id FROM relationships_in_model m1 JOIN relationships_in_model m2 ON m1.relationship_id = m2.relationship_id AND m1.model_id = m2.model_id WHERE m1.model_id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND m1.model_version = 0 AND m2.model_version = 0 AND m1.parent_folder_id <> m2.parent_folder_id
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT m2.folder_id AS folder_id, m2.parent_folder_id AS parent_folder_id FROM folders_in_model m1 JOIN folders_in_model m2 ON m1.folder_id = m2.folder_id AND m1.model_id = m2.model_id WHERE m1.model_id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND m1.model_version = 0 AND m2.model_version = 0 AND m1.parent_folder_id <> m2.parent_folder_id
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> SELECT m2.view_id AS view_id, m2.parent_folder_id AS parent_folder_id FROM views_in_model m1 JOIN views_in_model m2 ON m1.view_id = m2.view_id AND m1.model_id = m2.model_id WHERE m1.model_id = 'id-0b2343ffbb1e430d9227803fcce447a0' AND m1.model_version = 0 AND m2.model_version = 0 AND m1.parent_folder_id <> m2.parent_folder_id
2024-05-24 08:50:35 INFO  2541:DBGuiExportModel                         - There is no component to move to a new folder.
2024-05-24 08:50:35 INFO   988:DBGui                                    - Exporting model to the database ...
2024-05-24 08:50:35 DEBUG 1451:DBDatabaseConnection                     - Setting database auto commit to false
2024-05-24 08:50:35 INFO  2576:DBGuiExportModel                         - Exporting the model itself ...
2024-05-24 08:50:35 DEBUG 1421:DBDatabaseExportConnection               - Exporting model (initial version = 0, exported version = 1, latest database version = 0)
2024-05-24 08:50:35 TRACE  170:DBStatement                              -       --> INSERT INTO models (id, version, name, note, purpose, created_by, created_on, properties, features, checksum) VALUES ('id-0b2343ffbb1e430d9227803fcce447a0', 1, '(new model)', '', '', 'alf', 2024-05-24 08:50:35.359, 0, 0, 'bac40b852c8928364cb702c5c87e5d4b')
2024-05-24 08:50:35 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting specializations ..."
2024-05-24 08:50:35 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting elements ..."
2024-05-24 08:50:35 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting relationships ..."
2024-05-24 08:50:35 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting folders ..."
2024-05-24 08:50:35 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting views ..."
2024-05-24 08:50:35 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting view objects ..."
2024-05-24 08:50:35 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting view connections ..."
2024-05-24 08:50:35 INFO  1014:DBGui                                    - Setting progress bar label to "Exporting images ..."
2024-05-24 08:50:35 DEBUG 1460:DBDatabaseConnection                     - Committing database transaction.
2024-05-24 08:50:35 DEBUG  260:DBDatabaseConnection                     - Closing the database connection.
2024-05-24 08:50:35 DEBUG 2961:DBGuiExportModel                         - Copying current version to initial version.
2024-05-24 08:50:35 DEBUG 3234:DBGuiExportModel                         - Showing result.
2024-05-24 08:50:35 INFO  3243:DBGuiExportModel                         -                             <------ In model ------>   <----- In database ---->
2024-05-24 08:50:35 INFO  3244:DBGuiExportModel                         -                     Total      New  Updated  Deleted      New  Updated  Deleted Conflict
2024-05-24 08:50:35 INFO  3245:DBGuiExportModel                         -    Elements:            0        0        0        0        0        0        0        0
2024-05-24 08:50:35 INFO  3246:DBGuiExportModel                         -    Relationships:       0        0        0        0        0        0        0        0
2024-05-24 08:50:35 INFO  3248:DBGuiExportModel                         -    Folders:             0        0        0        0        0        0        0        0
2024-05-24 08:50:35 INFO  3249:DBGuiExportModel                         -    views:               0        0        0        0        0        0        0        0
2024-05-24 08:50:35 INFO  3250:DBGuiExportModel                         -    Objects:             0        0        0        0        0        0        0        0
2024-05-24 08:50:35 INFO  3251:DBGuiExportModel                         -    Connections:         0        0        0        0        0        0        0        0
2024-05-24 08:50:35 INFO  3252:DBGuiExportModel                         -    images:              0        0                          0
2024-05-24 08:50:35 INFO  1108:DBGui                                    - *** Export successful ***
DBPlugin Export CommandLine DBPlugin Export CommandLine: The model "(new model)" has been exported to the "export" database.
alf commented 5 months ago

The resulting database matches what we expact from the export summary. That is to say that it contains no data except for the profiles- and model- tables.

alf commented 5 months ago

Here's the contents of empty.archimate:

<?xml version="1.0" encoding="UTF-8"?>
<archimate:model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:archimate="http://www.archimatetool.com/archimate" name="(new model)" id="id-0b2343ffbb1e430d9227803fcce447a0" version="5.0.0">
  <folder name="Strategy" id="id-94b46b32d125464badc2abf04ef530d7" type="strategy"/>
  <folder name="Business" id="id-43dfe0b2a0ec460c8e6e9db55d989260" type="business"/>
  <folder name="Application" id="id-d30879bd7dce4664b96da8c084443708" type="application"/>
  <folder name="Technology &amp; Physical" id="id-c8ff35f13d5c456589aec4e00640949f" type="technology"/>
  <folder name="Motivation" id="id-6894de7b9406471ea057def1a632fb16" type="motivation"/>
  <folder name="Implementation &amp; Migration" id="id-0f4d6bd0b229426ba1da1ab22e9ccdc3" type="implementation_migration"/>
  <folder name="Other" id="id-8bc837a92c484baf94b6c69ccb5ea57e" type="other"/>
  <folder name="Relations" id="id-3a72475aa7f54d6a82aa1105425ae108" type="relations"/>
  <folder name="Views" id="id-5b274921d8b54b51a1a2d2eeebf4ce81" type="diagrams">
    <element xsi:type="archimate:ArchimateDiagramModel" name="Default View" id="id-df5bdfc520a749ada7c0802333e72372"/>
  </folder>
</archimate:model>
alf commented 5 months ago

While debugging this a bit I find that if I put a breakpoint on line 69 of DBExportModelProvider and run the following statement before continuing then things work as expected:

modelToExport.countAllObjects()
alf commented 5 months ago

I've now worked around the issue by adding a folder to the empty sqlite database to trigger the countAllObjects-statement in PHASE 4 of the export. I did this by running the following SQL:

INSERT INTO models VALUES('id-cf3f62c0f30c4d5ebb62626981eb9409',1,'Arkitektur Studieadministrasjon','','','alf',1716542487851,NULL,NULL,NULL,NULL,0,0,'00000000000000000000000000000000');
INSERT INTO folders VALUES('id-33a902e3f31a455ebed096a944eb5d8e',1,0,7,'-','','alf',1716546724287,NULL,NULL,NULL,NULL,0,0,'00000000000000000000000000000000');
INSERT INTO folders_in_model VALUES(1,'id-33a902e3f31a455ebed096a944eb5d8e',1,NULL,'id-cf3f62c0f30c4d5ebb62626981eb9409',1,1);
herve91 commented 5 months ago

Hi, I read again your first post and I realize that I misunderstood your context ... You're not using the GUI but the command line.

I'll do some more testing using the command line and will come back to you asap. Thanks for your comment and detailed log files, it will help.

herve91 commented 4 months ago

fixed in version 4.9.8 that will be released very soon