Problem when duplicating a database

Hello All,

Facing a problem trying to duplicate a database.

I have this message:
“Something went wrong during the duplicate_application job execution”

Any idea?

Thanks,

Toni

Hi @Calpp,

you will really need to provide more details about your problem, starting with how and where you run Baserow.

Here is the docker log if it can help

 [EXPORT_WORKER][2023-10-23 15:34:07] [2023-10-23 15:34:00,023: INFO/MainProcess] Task baserow.core.notifications.tasks.beat_send_instant_notifications_summary_by_email[466c8e80-8862-4682-b405-19d734430f12] received  
 [EXPORT_WORKER][2023-10-23 15:34:07] [2023-10-23 15:34:07,052: ERROR/ForkPoolWorker-1] Task baserow.core.jobs.tasks.run_async_job[6884c0c4-8699-41f9-8502-8f23e09d09a3] raised unexpected: DataError('cannot extract elements from a scalar\n')  
 [EXPORT_WORKER][2023-10-23 15:34:07] Traceback (most recent call last):  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute  
 [EXPORT_WORKER][2023-10-23 15:34:07]     return self.cursor.execute(sql, params)  
 [EXPORT_WORKER][2023-10-23 15:34:07] psycopg2.errors.InvalidParameterValue: cannot extract elements from a scalar  
 [EXPORT_WORKER][2023-10-23 15:34:07]   
 [EXPORT_WORKER][2023-10-23 15:34:07]   
 [EXPORT_WORKER][2023-10-23 15:34:07] The above exception was the direct cause of the following exception:  
 [EXPORT_WORKER][2023-10-23 15:34:07]   
 [EXPORT_WORKER][2023-10-23 15:34:07] Traceback (most recent call last):  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/celery/app/trace.py", line 451, in trace_task  
 [EXPORT_WORKER][2023-10-23 15:34:07]     R = retval = fun(*args, **kwargs)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/celery/app/trace.py", line 734, in __protected_call__  
 [EXPORT_WORKER][2023-10-23 15:34:07]     return self.run(*args, **kwargs)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/core/jobs/tasks.py", line 34, in run_async_job  
 [EXPORT_WORKER][2023-10-23 15:34:07]     JobHandler().run(job)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/core/jobs/handler.py", line 59, in run  
 [EXPORT_WORKER][2023-10-23 15:34:07]     return job_type.run(job, progress)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/core/job_types.py", line 95, in run  
 [EXPORT_WORKER][2023-10-23 15:34:07]     new_application_clone = action_type_registry.get_by_type(  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/core/actions.py", line 612, in do  
 [EXPORT_WORKER][2023-10-23 15:34:07]     new_app_clone = CoreHandler().duplicate_application(  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/core/telemetry/utils.py", line 72, in _wrapper  
 [EXPORT_WORKER][2023-10-23 15:34:07]     raise ex  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/core/telemetry/utils.py", line 68, in _wrapper  
 [EXPORT_WORKER][2023-10-23 15:34:07]     result = wrapped_func(*args, **kwargs)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/core/handler.py", line 1409, in duplicate_application  
 [EXPORT_WORKER][2023-10-23 15:34:07]     new_application_clone = application_type.import_serialized(  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/contrib/database/application_types.py", line 535, in import_serialized  
 [EXPORT_WORKER][2023-10-23 15:34:07]     self.import_tables_serialized(  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/contrib/database/application_types.py", line 479, in import_tables_serialized  
 [EXPORT_WORKER][2023-10-23 15:34:07]     update_collector.apply_updates_and_get_updated_fields(  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/contrib/database/fields/dependencies/update_collector.py", line 329, in apply_updates_and_get_updated_fields  
 [EXPORT_WORKER][2023-10-23 15:34:07]     self._update_statement_collector.execute_all(  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/contrib/database/fields/dependencies/update_collector.py", line 135, in execute_all  
 [EXPORT_WORKER][2023-10-23 15:34:07]     sub_path.execute_all(  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/contrib/database/fields/dependencies/update_collector.py", line 127, in execute_all  
 [EXPORT_WORKER][2023-10-23 15:34:07]     self._execute_pending_update_statements(  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/backend/src/baserow/contrib/database/fields/dependencies/update_collector.py", line 174, in _execute_pending_update_statements  
 [EXPORT_WORKER][2023-10-23 15:34:07]     qs.update(**self.update_statements)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method  
 [EXPORT_WORKER][2023-10-23 15:34:07]     return getattr(self.get_queryset(), name)(*args, **kwargs)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/django/db/models/query.py", line 783, in update  
 [EXPORT_WORKER][2023-10-23 15:34:07]     rows = query.get_compiler(self.db).execute_sql(CURSOR)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1559, in execute_sql  
 [EXPORT_WORKER][2023-10-23 15:34:07]     cursor = super().execute_sql(result_type)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql  
 [EXPORT_WORKER][2023-10-23 15:34:07]     cursor.execute(sql, params)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute  
 [EXPORT_WORKER][2023-10-23 15:34:07]     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers  
 [EXPORT_WORKER][2023-10-23 15:34:07]     return executor(sql, params, many, context)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute  
 [EXPORT_WORKER][2023-10-23 15:34:07]     return self.cursor.execute(sql, params)  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__  
 [EXPORT_WORKER][2023-10-23 15:34:07]     raise dj_exc_value.with_traceback(traceback) from exc_value  
 [EXPORT_WORKER][2023-10-23 15:34:07]   File "/baserow/venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute  
 [EXPORT_WORKER][2023-10-23 15:34:07]     return self.cursor.execute(sql, params)  
 [EXPORT_WORKER][2023-10-23 15:34:07] django.db.utils.DataError: cannot extract elements from a scalar  
 [EXPORT_WORKER][2023-10-23 15:34:07]   
 [EXPORT_WORKER][2023-10-23 15:34:07] [2023-10-23 15:34:07,062: INFO/MainProcess] Task baserow.core.notifications.tasks.singleton_send_instant_notifications_summary_by_email[be916cc4-e7fe-4917-b7cc-e2c4bf67fefa] received  
 [EXPORT_WORKER][2023-10-23 15:34:07] [2023-10-23 15:34:07,062: INFO/ForkPoolWorker-1] Task baserow.core.notifications.tasks.beat_send_instant_notifications_summary_by_email[466c8e80-8862-4682-b405-19d734430f12] succeeded in 0.0033010118640959263s: None  

Hi @petrs ,

Thanks for your message.
We run Baserow in Digital Ocean (self hosted)

Hi @petrs, thanks a lot for your support.
I understand.
Please find in the message from @Clapp the logs we get.
It is a new instance (few weeks). We are building an ERP for a customer. He tried to duplicate the table to train himself just by clicking on the Baserow interface. The duplication seems to run, we see the percentage increase and then the error message :frowning:

Does the duplication work for you in general? For example, does it work with some random templates? I think the problem might be very specific to what you have in the database.

Is the database that you want to duplicate big? Would you be able to find a reproducible example?

Hi @petrs we are not able to reproduce the problem, we can duplicate other bases in the same workspace. The bases is not big at all: 12 tables, ~150 fields and ~100 rows…

Can you try removing things in the database until you get to a point when you can duplicate it without a problem? Perhaps that would give you a hint what part is causing the problem.

I don’t think I can help you without reproducible example.

Thanks a lot @petrs.
We have just solved this problem!
It was just un concat field in a key table including look ups…

But do you think this is actual bug or not? If so we can maybe arrive to some bug report and fix it on our side.

So that was some broken formula field that didn’t want to be duplicated?

Hello @petrs, I will not say that it is a bug because I am not able to reproduce it.
Here the formula in the key table:

concat(field(‘Référence Entité facturable’),’-’,field(‘Chrono prestation’),’-’,field(‘Initiales owner’))

field(‘Référence Entité facturable’): Look-up (txt field)
field(‘Chrono prestation’): txt field
field(‘Initiales owner’): Look-up (txt field)

I built excatly the same in another base, no problem to duplicate…

Thanks again for you support and sorry to not be able to bring a scenrio to reproduce what we had to face.

1 Like