Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync-full > TypeError: bytes or buffer expected, got <class 'str'> #872

Open
flinfo opened this issue Oct 16, 2024 · 0 comments
Open

sync-full > TypeError: bytes or buffer expected, got <class 'str'> #872

flinfo opened this issue Oct 16, 2024 · 0 comments
Assignees
Labels

Comments

@flinfo
Copy link

flinfo commented Oct 16, 2024

Context

Studio name: flux
Zou version: 0.19.12
Zou installation type: self-hosted x 2

Describe the bug
When trying the full-sync facility, I get errors, described below.

Expected behavior
Expecting a project db entrys to sync between 2 seperate instances.

Additional context
I have set up a second, identical instance of kitsu.
So we have Primary kitsu instance and a Secondary.
No problems doing a backup from Primary and restoring on Secondary.
But when attempt to sync to Secondary, it fails with the below errors.
I have created a dummy project on Primary for this testing called 'test4'

Issuing command:
SYNC_LOGIN="[email protected]" SYNC_PASSWORD="###################" zou sync-full --source https://testdomain.com/api --project test4

returns:

Start syncing. Traceback (most recent call last): File "/opt/zou/zouenv/bin/zou", line 8, in <module> sys.exit(cli()) File "/opt/zou/zouenv/lib/python3.8/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) File "/opt/zou/zouenv/lib/python3.8/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/opt/zou/zouenv/lib/python3.8/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/zou/zouenv/lib/python3.8/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) File "/opt/zou/zouenv/lib/python3.8/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) File "/opt/zou/zouenv/lib/python3.8/site-packages/zou/cli.py", line 304, in sync_full commands.import_data_from_another_instance( File "/opt/zou/zouenv/lib/python3.8/site-packages/zou/app/utils/commands.py", line 491, in import_data_from_another_instance sync_service.run_main_data_sync(project=project) File "/opt/zou/zouenv/lib/python3.8/site-packages/zou/app/services/sync_service.py", line 287, in run_main_data_sync sync_entries(path, model, project=project) File "/opt/zou/zouenv/lib/python3.8/site-packages/zou/app/services/sync_service.py", line 412, in sync_entries model.create_from_import_list(instances) File "/opt/zou/zouenv/lib/python3.8/site-packages/zou/app/models/base.py", line 173, in create_from_import_list cls.create_from_import(data) File "/opt/zou/zouenv/lib/python3.8/site-packages/zou/app/models/person.py", line 218, in create_from_import previous_person.update(person) File "/opt/zou/zouenv/lib/python3.8/site-packages/zou/app/models/base.py", line 231, in update db.session.commit() File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/scoping.py", line 597, in commit return self._proxied.commit() File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1972, in commit trans.commit(_to_root=True) File "<string>", line 2, in commit File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go ret_value = fn(self, *arg, **kw) File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1257, in commit self._prepare_impl() File "<string>", line 2, in _prepare_impl File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go ret_value = fn(self, *arg, **kw) File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1232, in _prepare_impl self.session.flush() File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 4296, in flush self._flush(objects) File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 4432, in _flush transaction.rollback(_capture_exception=True) File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__ raise exc_value.with_traceback(exc_tb) File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 4392, in _flush flush_context.execute() File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute rec.execute(self) File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute util.preloaded.orm_persistence.save_obj( File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 85, in save_obj _emit_update_statements( File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 912, in _emit_update_statements c = connection.execute( File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1421, in execute return meth( File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 514, in _execute_on_connection return connection._execute_clauseelement( File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1643, in _execute_clauseelement ret = self._execute_context( File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1849, in _execute_context return self._exec_single_context( File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1989, in _exec_single_context self._handle_dbapi_exception( File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2359, in _handle_dbapi_exception raise exc_info[1].with_traceback(exc_info[2]) File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1970, in _exec_single_context self.dialect.do_execute( File "/opt/zou/zouenv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 924, in do_execute cursor.execute(statement, parameters) File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/cursor.py", line 728, in execute self._conn.wait( File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/connection.py", line 969, in wait return waiting.wait(gen, self.pgconn.socket, timeout=timeout) File "psycopg_binary/_psycopg/waiting.pyx", line 190, in psycopg_binary._psycopg.wait_c File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/cursor.py", line 210, in _execute_gen pgq = self._convert_query(query, params) File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/cursor.py", line 483, in _convert_query pgq.convert(query, params) File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/_queries.py", line 94, in convert self.dump(vars) File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/_queries.py", line 105, in dump self.params = self._tx.dump_sequence(params, self._want_formats) File "psycopg_binary/_psycopg/transform.pyx", line 353, in psycopg_binary._psycopg.Transformer.dump_sequence File "psycopg_binary/_psycopg/transform.pyx", line 404, in psycopg_binary._psycopg.Transformer.dump_sequence File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/types/array.py", line 184, in dump dump_list(obj) File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/types/array.py", line 171, in dump_list ad = self._dump_item(item) File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/types/array.py", line 190, in _dump_item return self.sub_dumper.dump(item) File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/dbapi20.py", line 69, in dump return super().dump(obj.obj) File "/opt/zou/zouenv/lib/python3.8/site-packages/psycopg/types/string.py", line 136, in dump return self._esc.escape_bytea(obj) File "psycopg_binary/pq/escaping.pyx", line 90, in psycopg_binary.pq.Escaping.escape_bytea File "psycopg_binary/pq/escaping.pyx", line 99, in psycopg_binary.pq.Escaping.escape_bytea File "psycopg_binary/pq/pqbuffer.pyx", line 111, in psycopg_binary.pq._buffer_as_string_and_size TypeError: bytes or buffer expected, got <class 'str'>

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants