Running 'bench update' in an Environment with a Remote Database Server

Dear Experts,

Has anyone been successful in updating the bench + apps in an environment where there is a remote database server configuration?

I have tried many times and have always hit the following error:


File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 467, in runner

    add_to_return_value(self, fn(self, *args, **kwargs))

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 400, in <lambda>

    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)

  File "/home/strella/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 87, in on_update

    updatedb(self.name)

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 390, in updatedb

    tab.sync()

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 170, in sync

    self.create()

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 90, in create

    CHARACTER SET=utf8""" % (self.name, add_text))

  File "/home/strella/frappe-bench/apps/frappe/frappe/database.py", line 119, in sql

    self._cursor.execute(query)

  File "/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute

    self.errorhandler(self, exc, value)

  File "/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler

    raise errorclass, errorvalue

_mysql_exceptions.OperationalError: (1050, "Table 'tabsales invoice' already exists")

Error: None

Traceback (most recent call last):

  File "/usr/local/bin/bench", line 9, in <module>

    load_entry_point('bench==0.1', 'console_scripts', 'bench')()

  File "/home/strella/bench-repo/bench/cli.py", line 26, in cli

    def cli():

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 572, in __call__

    return self.main(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 552, in main

    rv = self.invoke(ctx)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 893, in invoke

    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 744, in invoke

    return ctx.invoke(self.callback, **ctx.params)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 388, in invoke

    return callback(*args, **kwargs)

  File "/home/strella/bench-repo/bench/cli.py", line 96, in update

    @click.option('--auto',flag_value=True, type=bool)

  File "/home/strella/bench-repo/bench/utils.py", line 77, in patch_sites

    exec_cmd("{frappe} --latest all".format(frappe=get_frappe(bench=bench)), cwd=os.path.join(bench, 'sites'))

  File "/home/strella/bench-repo/bench/utils.py", line 56, in exec_cmd

    subprocess.check_call(cmd, cwd=cwd, shell=True)

  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call

    raise CalledProcessError(retcode, cmd)

subprocess.CalledProcessError: Command '/home/strella/frappe-bench/env/bin/frappe --latest all' returned non-zero exit status 1


The only solution that I have is:

1) Backup + restore the remote database to the local database

2) Revert site_config.json to use back the local database

3) Run 'bench update'

4) Backup + restore the local database back to the remote database server


It is honestly quite tedious.... Look forward to seeing if any of you have good solutions to this. Thanks once again.


Javier



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/fde9173f-0a64-4fa5-abfa-7123fd517148%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Seems to be a different kind of error - maybe the database is not patched... or you have local changes that seem to be conflicting

On 03-Sep-2014, at 4:00 pm, Javier <bo...@gmail.com> wrote:

Dear Experts,

Has anyone been successful in updating the bench + apps in an environment where there is a remote database server configuration?

I have tried many times and have always hit the following error:


File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 467, in runner

    add_to_return_value(self, fn(self, *args, **kwargs))

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 400, in <lambda>

    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)

  File "/home/strella/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 87, in on_update

    updatedb(self.name)

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 390, in updatedb

    tab.sync()

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 170, in sync

    self.create()

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 90, in create

    CHARACTER SET=utf8""" % (self.name, add_text))

  File "/home/strella/frappe-bench/apps/frappe/frappe/database.py", line 119, in sql

    self._cursor.execute(query)

  File "/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute

    self.errorhandler(self, exc, value)

  File "/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler

    raise errorclass, errorvalue

_mysql_exceptions.OperationalError: (1050, "Table 'tabsales invoice' already exists")

Error: None

Traceback (most recent call last):

  File "/usr/local/bin/bench", line 9, in <module>

    load_entry_point('bench==0.1', 'console_scripts', 'bench')()

  File "/home/strella/bench-repo/bench/cli.py", line 26, in cli

    def cli():

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 572, in __call__

    return self.main(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 552, in main

    rv = self.invoke(ctx)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 893, in invoke

    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 744, in invoke

    return ctx.invoke(self.callback, **ctx.params)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 388, in invoke

    return callback(*args, **kwargs)

  File "/home/strella/bench-repo/bench/cli.py", line 96, in update

    @click.option('--auto',flag_value=True, type=bool)

  File "/home/strella/bench-repo/bench/utils.py", line 77, in patch_sites

    exec_cmd("{frappe} --latest all".format(frappe=get_frappe(bench=bench)), cwd=os.path.join(bench, 'sites'))

  File "/home/strella/bench-repo/bench/utils.py", line 56, in exec_cmd

    subprocess.check_call(cmd, cwd=cwd, shell=True)

  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call

    raise CalledProcessError(retcode, cmd)


subprocess.CalledProcessError: Command ‘/home/strella/frappe-bench/env/bin/frappe --latest all’ returned non-zero exit status 1


The only solution that I have is:

1) Backup + restore the remote database to the local database

2) Revert site_config.json to use back the local database

3) Run 'bench update’

4) Backup + restore the local database back to the remote database server


It is honestly quite tedious… Look forward to seeing if any of you have good solutions to this. Thanks once again.


Javier




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/fde9173f-0a64-4fa5-abfa-7123fd517148%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/8A2E6ADD-02B3-401A-B2C4-854076399547%40gmail.com.

For more options, visit https://groups.google.com/d/optout.

Really? well I tried to simulate it again today but it runs successfully. I suspect it only throws error when there is something to be updated on the DB side. Anyhow, will let you guys know if I hit the problem again. Thanks Rushabh.

On Wednesday, September 3, 2014 8:58:46 PM UTC+8, Rushabh Mehta wrote:
Seems to be a different kind of error - maybe the database is not patched... or you have local changes that seem to be conflicting

On 03-Sep-2014, at 4:00 pm, Javier <bo...@gmail.com> wrote:

Dear Experts,

Has anyone been successful in updating the bench + apps in an environment where there is a remote database server configuration?

I have tried many times and have always hit the following error:


File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 467, in runner

    add_to_return_value(self, fn(self, *args, **kwargs))

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 400, in <lambda>

    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)

  File "/home/strella/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 87, in on_update

    updatedb(self.name)

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 390, in updatedb

    tab.sync()

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 170, in sync

    self.create()

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 90, in create

    CHARACTER SET=utf8""" % (self.name, add_text))

  File "/home/strella/frappe-bench/apps/frappe/frappe/database.py", line 119, in sql

    self._cursor.execute(query)

  File "/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute

    self.errorhandler(self, exc, value)

  File "/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler

    raise errorclass, errorvalue

_mysql_exceptions.OperationalError: (1050, "Table 'tabsales invoice' already exists")

Error: None

Traceback (most recent call last):

  File "/usr/local/bin/bench", line 9, in <module>

    load_entry_point('bench==0.1', 'console_scripts', 'bench')()

  File "/home/strella/bench-repo/bench/cli.py", line 26, in cli

    def cli():

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 572, in __call__

    return self.main(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 552, in main

    rv = self.invoke(ctx)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 893, in invoke

    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 744, in invoke

    return ctx.invoke(self.callback, **ctx.params)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 388, in invoke

    return callback(*args, **kwargs)

  File "/home/strella/bench-repo/bench/cli.py", line 96, in update

    @click.option('--auto',flag_value=True, type=bool)

  File "/home/strella/bench-repo/bench/utils.py", line 77, in patch_sites

    exec_cmd("{frappe} --latest all".format(frappe=get_frappe(bench=bench)), cwd=os.path.join(bench, 'sites'))

  File "/home/strella/bench-repo/bench/utils.py", line 56, in exec_cmd

    subprocess.check_call(cmd, cwd=cwd, shell=True)

  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call

    raise CalledProcessError(retcode, cmd)


subprocess.CalledProcessError: Command ‘/home/strella/frappe-bench/env/bin/frappe --latest all’ returned non-zero exit status 1


The only solution that I have is:

1) Backup + restore the remote database to the local database

2) Revert site_config.json to use back the local database

3) Run 'bench update’

4) Backup + restore the local database back to the remote database server


It is honestly quite tedious… Look forward to seeing if any of you have good solutions to this. Thanks once again.


Javier




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/fde9173f-0a64-4fa5-abfa-7123fd517148%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/d0312e65-b020-4552-b41e-4a2b89d6a023%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Dear Rushabh,

Did a bench update today and this is the problem that I get...

File "/home/strella/frappe-bench/env/bin/frappe", line 9, in <module>
    load_entry_point('frappe==4.1.0', 'console_scripts', 'frappe')()
  File "/home/strella/frappe-bench/apps/frappe/frappe/cli.py", line 39, in main
    ret = run(fn, args)
  File "/home/strella/frappe-bench/apps/frappe/frappe/cli.py", line 83, in run
    out = globals().get(fn)(**args)
  File "/home/strella/frappe-bench/apps/frappe/frappe/cli.py", line 67, in new_fn
    return fn(*args, **new_kwargs)
  File "/home/strella/frappe-bench/apps/frappe/frappe/cli.py", line 424, in latest
    frappe.model.sync.sync_all(verbose=verbose)
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/sync.py", line 19, in sync_all
    sync_for(app, force, verbose=verbose)
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/sync.py", line 34, in sync_for
    import_file_by_path(doc_path, force=force)
  File "/home/strella/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 50, in import_file_by_path
    import_doc(doc, force=force)
  File "/home/strella/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 111, in import_doc
    doc.insert()
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 156, in insert
    self.run_post_save_methods()
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 436, in run_post_save_methods
    self.run_method("on_update")
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 406, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 487, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 470, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 400, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/strella/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 87, in on_update
    updatedb(self.name)
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 390, in updatedb
    tab.sync()
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 170, in sync
    self.create()
  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 90, in create
    CHARACTER SET=utf8""" % (self.name, add_text))
  File "/home/strella/frappe-bench/apps/frappe/frappe/database.py", line 119, in sql
    self._cursor.execute(query)
  File "/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1050, "Table 'tabstock entry' already exists")
Error: None
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/strella/bench-repo/bench/cli.py", line 29, in cli
    return bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 572, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 552, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 893, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 744, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 388, in invoke
    return callback(*args, **kwargs)
  File "/home/strella/bench-repo/bench/cli.py", line 116, in update
    patch_sites()
  File "/home/strella/bench-repo/bench/utils.py", line 77, in patch_sites
    if len(get_sites(bench=bench)) == 1:
  File "/home/strella/bench-repo/bench/utils.py", line 56, in exec_cmd

  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/home/strella/frappe-bench/env/bin/frappe --latest all' returned non-zero exit status 1

I believe this should be the consistent error message that I receive when using a remote database server. Any chance you have any idea?



Javier




On Thursday, September 4, 2014 2:09:43 PM UTC+8, Javier wrote:
Really? well I tried to simulate it again today but it runs successfully. I suspect it only throws error when there is something to be updated on the DB side. Anyhow, will let you guys know if I hit the problem again. Thanks Rushabh.

On Wednesday, September 3, 2014 8:58:46 PM UTC+8, Rushabh Mehta wrote:
Seems to be a different kind of error - maybe the database is not patched... or you have local changes that seem to be conflicting

On 03-Sep-2014, at 4:00 pm, Javier <bo...@gmail.com> wrote:

Dear Experts,

Has anyone been successful in updating the bench + apps in an environment where there is a remote database server configuration?

I have tried many times and have always hit the following error:


File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 467, in runner

    add_to_return_value(self, fn(self, *args, **kwargs))

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/document.py", line 400, in <lambda>

    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)

  File "/home/strella/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 87, in on_update

    updatedb(self.name)

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 390, in updatedb

    tab.sync()

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 170, in sync

    self.create()

  File "/home/strella/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 90, in create

    CHARACTER SET=utf8""" % (self.name, add_text))

  File "/home/strella/frappe-bench/apps/frappe/frappe/database.py", line 119, in sql

    self._cursor.execute(query)

  File "/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute

    self.errorhandler(self, exc, value)

  File "/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler

    raise errorclass, errorvalue

_mysql_exceptions.OperationalError: (1050, "Table 'tabsales invoice' already exists")

Error: None

Traceback (most recent call last):

  File "/usr/local/bin/bench", line 9, in <module>

    load_entry_point('bench==0.1', 'console_scripts', 'bench')()

  File "/home/strella/bench-repo/bench/cli.py", line 26, in cli

    def cli():

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 572, in __call__

    return self.main(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 552, in main

    rv = self.invoke(ctx)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 893, in invoke

    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 744, in invoke

    return ctx.invoke(self.callback, **ctx.params)

  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 388, in invoke

    return callback(*args, **kwargs)

  File "/home/strella/bench-repo/bench/cli.py", line 96, in update

    @click.option('--auto',flag_value=True, type=bool)

  File "/home/strella/bench-repo/bench/utils.py", line 77, in patch_sites

    exec_cmd("{frappe} --latest all".format(frappe=get_frappe(bench=bench)), cwd=os.path.join(bench, 'sites'))

  File "/home/strella/bench-repo/bench/utils.py", line 56, in exec_cmd

    subprocess.check_call(cmd, cwd=cwd, shell=True)

  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call

    raise CalledProcessError(retcode, cmd)


subprocess.CalledProcessError: Command ‘/home/strella/frappe-bench/env/bin/frappe --latest all’ returned non-zero exit status 1


The only solution that I have is:

1) Backup + restore the remote database to the local database

2) Revert site_config.json to use back the local database

3) Run 'bench update’

4) Backup + restore the local database back to the remote database server


It is honestly quite tedious… Look forward to seeing if any of you have good solutions to this. Thanks once again.


Javier




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/fde9173f-0a64-4fa5-abfa-7123fd517148%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/aeed6798-902f-4a1e-8db0-2200472fd062%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.