seletinload track on is using variable length for columns
See original GitHub issueHello,
After update sqlalchemy from version 1.3+ to version 1.4+ and running my tests I am getting randomly this error:
___________________ TestEventRegistration.test_company_data ____________________
[gw4] linux -- Python 3.8.0 /usr/local/bin/python
self = <src.coma.tests.social_api.test_custom_event_registration.TestEventRegistration object at 0x7fa09ad63eb0>
create_event = <function create_event.<locals>._create_event at 0x7fa098feab80>
create_user = <function create_user.<locals>._create_user at 0x7fa0a2bc35e0>
user_to_admin = <function user_to_admin.<locals>._user_to_admin at 0x7fa09a02bc10>
user_to_operator = <function user_to_operator.<locals>._user_to_operator at 0x7fa09948c1f0>
testapp = <webtest.app.TestApp object at 0x7fa0a78ed1c0>
get_form_nodes = <function get_form_nodes.<locals>._get_form_nodes at 0x7fa09948c160>
create_form_node = <function create_form_node.<locals>._create_form_node at 0x7fa09948c040>
prepare_valid_form_result = <function prepare_valid_form_result.<locals>.wrapped at 0x7fa09948c310>
def test_company_data(
self, create_event, create_user, user_to_admin, user_to_operator,
testapp, get_form_nodes, create_form_node, prepare_valid_form_result):
""" Create company data node """
operator = create_user().json['user']
user_to_admin(operator['id'])
event = create_event({"custom_registration": True}).json
event_id = event['id']
# add node
defined_company_data = {
'defined_type': 'company-data',
'required': True,
}
> response = create_form_node(event_id, 'registration', defined_company_data)
src/coma/tests/social_api/test_custom_event_registration.py:428:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/coma/tests/fixtures/forms.py:90: in _create_form_node
return testapp.post_json(
/usr/local/lib/python3.8/site-packages/webtest/utils.py:36: in wrapper
return self._gen_request(method, url, **kw)
/usr/local/lib/python3.8/site-packages/webtest/app.py:752: in _gen_request
return self.do_request(req, status=status,
/usr/local/lib/python3.8/site-packages/webtest/app.py:623: in do_request
res = req.get_response(app, catch_exc_info=True)
/usr/local/lib/python3.8/site-packages/webob/request.py:1309: in send
status, headers, app_iter, exc_info = self.call_application(
/usr/local/lib/python3.8/site-packages/webob/request.py:1278: in call_application
app_iter = application(self.environ, start_response)
/usr/local/lib/python3.8/site-packages/webtest/lint.py:201: in lint_app
iterator = application(environ, start_response_wrapper)
/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/pyramid.py:131: in sentry_patched_wsgi_call
return SentryWsgiMiddleware(sentry_patched_inner_wsgi_call)(
/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/wsgi.py:140: in __call__
reraise(*_capture_exception(hub))
/usr/local/lib/python3.8/site-packages/sentry_sdk/_compat.py:54: in reraise
raise value
/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/wsgi.py:133: in __call__
rv = self.app(
/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/pyramid.py:129: in sentry_patched_inner_wsgi_call
reraise(*einfo)
/usr/local/lib/python3.8/site-packages/sentry_sdk/_compat.py:54: in reraise
raise value
/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/pyramid.py:125: in sentry_patched_inner_wsgi_call
return old_wsgi_call(self, environ, start_response)
/usr/local/lib/python3.8/site-packages/pyramid/router.py:270: in __call__
response = self.execution_policy(environ, self)
/usr/local/lib/python3.8/site-packages/pyramid/router.py:276: in default_execution_policy
return router.invoke_request(request)
/usr/local/lib/python3.8/site-packages/pyramid/router.py:245: in invoke_request
response = handle_request(request)
src/coma/tweens.py:29: in invalid_path_tween
return handler(request)
src/coma/tweens.py:8: in conditional_http_tween
response = handler(request)
/usr/local/lib/python3.8/site-packages/pyramid_tm/__init__.py:178: in tm_tween
reraise(*exc_info)
/usr/local/lib/python3.8/site-packages/pyramid_tm/compat.py:36: in reraise
raise value
/usr/local/lib/python3.8/site-packages/pyramid_tm/__init__.py:143: in tm_tween
response = handler(request)
/usr/local/lib/python3.8/site-packages/pyramid/tweens.py:43: in excview_tween
response = _error_handler(request, exc)
/usr/local/lib/python3.8/site-packages/pyramid/tweens.py:13: in _error_handler
response = request.invoke_exception_view(exc_info)
/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/pyramid.py:99: in sentry_patched_invoke_exception_view
rv = old_invoke_exception_view(self, *args, **kwargs)
/usr/local/lib/python3.8/site-packages/pyramid/view.py:765: in invoke_exception_view
response = _call_view(
/usr/local/lib/python3.8/site-packages/pyramid/view.py:674: in _call_view
response = view_callable(context, request)
/usr/local/lib/python3.8/site-packages/pyramid/viewderivers.py:392: in viewresult_to_response
result = view(context, request)
/usr/local/lib/python3.8/site-packages/pyramid/tweens.py:41: in excview_tween
response = handler(request)
src/coma/tweens.py:40: in invalid_json_tween
return handler(request)
/usr/local/lib/python3.8/site-packages/pyramid/router.py:143: in handle_request
response = _call_view(
/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/pyramid.py:90: in sentry_patched_call_view
return old_call_view(registry, request, *args, **kwargs)
/usr/local/lib/python3.8/site-packages/pyramid/view.py:674: in _call_view
response = view_callable(context, request)
/usr/local/lib/python3.8/site-packages/pyramid/config/views.py:151: in __call__
return view(context, request)
/usr/local/lib/python3.8/site-packages/pyramid/config/views.py:170: in attr_view
return view(context, request)
/usr/local/lib/python3.8/site-packages/pyramid/config/views.py:196: in predicate_wrapper
return view(context, request)
/usr/local/lib/python3.8/site-packages/pyramid/viewderivers.py:319: in secured_view
return view(context, request)
/usr/local/lib/python3.8/site-packages/pyramid/viewderivers.py:427: in rendered_view
result = view(context, request)
/usr/local/lib/python3.8/site-packages/pyramid/viewderivers.py:141: in _requestonly_view
response = view(request)
/usr/local/lib/python3.8/site-packages/cornice/service.py:590: in wrapper
response = view_()
src/coma/webapi/event_forms.py:446: in collection_post
item = self.service.create_node(form, self.request.validated, form_type=form_type)
src/coma/services/forms.py:105: in create_node
self.__update_required(node, required=data.get('required', False))
src/coma/services/forms.py:223: in __update_required
for n in node.nodes:
/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py:480: in __get__
return self.impl.get(state, dict_)
/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py:927: in get
value = self.callable_(state, passive)
/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py:878: in _load_for_state
return self._emit_lazyload(
/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py:1045: in _emit_lazyload
result = result.unique().scalars().all()
/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/result.py:1320: in all
return self._allrows()
/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/result.py:400: in _allrows
rows = self._fetchall_impl()
/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/result.py:1233: in _fetchall_impl
return self._real_result._fetchall_impl()
/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/result.py:1620: in _fetchall_impl
return list(self.iterator)
/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py:131: in chunks
post_load.invoke(context, path)
/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py:1309: in invoke
loader(context, path, states, self.load_keys, *arg, **kw)
/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py:2854: in _load_for_path
q = sql.lambda_stmt(
/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/lambdas.py:101: in lambda_stmt
return StatementLambdaElement(
/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/lambdas.py:161: in __init__
rec = self._retrieve_tracker_rec(fn, apply_propagate_attrs, opts)
/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/lambdas.py:187: in _retrieve_tracker_rec
[
/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/lambdas.py:188: in <listcomp>
getter(closure, opts, anon_map, bindparams)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
closure = (<cell at 0x7fa09b24b280: Mapper object at 0x7fa0ad452df0>, <cell at 0x7fa09b24bd60: list object at 0x7fa0a15a3600>)
opts = LambdaOptions(enable_tracking=True, global_track_bound_values=False, lambda_cache={}, track_bound_values=True, track_c...fa0ad452df0; FormNode>, Column('parent_node_id', UUID(as_uuid=True), ForeignKey('form_nodes.id'), table=<form_nodes>)))
anon_map = {140328078485008: '0'}, bindparams = []
def get(closure, opts, anon_map, bindparams):
> return opts.track_on[idx]._gen_cache_key(anon_map, bindparams)
E IndexError: tuple index out of range
I am getting them only if I ran my full test case no matter: parallel or in the sequence. When I ran a single test, single class or file, or even whole directory error did not occur. Please help me. Do you know what is happening?
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Fits variable lengths column can be read into a table, but not ...
I can read a fits table with a variable length array using the unified I/O, but I cannot write it. Expected behavior. Write...
Read more >Does having variable-length columns slow selects on InnoDB ...
With MyISAM having variable length columns (varchar, blob) on the table really slowed queries so that I encountered advices on the net to...
Read more >SR0009 Avoid using types of variable length that are size 1 or 2
"When you use data types of variable length such as VARCHAR, NVARCHAR, and VARBINARY, you incur an additional storage cost to track the...
Read more >Loading variable-length data - IBM
You can load variable-length data by using the LOAD utility. ... The value in that field depends on the data type of the...
Read more >Using a Variable-length Datatype Without Explicit Length
If you declare a column as a CHAR , NCHAR , VARCHAR or NVARCHAR without a length, SQL Server reads that as a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Great, thanks for the feedback. Yesterday 1.4.13 was released, so you can also install the last version from pypi
so after using master branch as my sqlalchemy, error is not occurring anymore, thanks!