I am having some database problems (attached below), any recommendations
to either recover from or fix these from happening?
I am not sure why it would work OK at first, and then at some point run
bad... Any recommendations on a technique to debug this would be much
appreciated.

Full source code of the project can be browsed here:
http://git.braydon.com/gitweb.cgi?p=sparrow;a=tree;h=refs/heads/master;hb=refs/heads/master

For an idea of the project (screencast... although slightly old):
http://interfce.com/videos/sparrow.html

The site this is coming from (live):
http://mochilla.com/




[05/Jun/2008:22:16:15] HTTP Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line
550, in respond
    cherrypy.response.body = self.handler()
  File "/var/lib/python-support/python2.5/cherrypy/_cpdispatch.py", line
24, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/var/local/mochilla/sparrow/http.py", line 38, in default
    return render(args, kwargs, location_st)
  File "/var/local/mochilla/sparrow/templates.py", line 363, in render
    return render_skeleton(location, location_st, kwargs)
  File "/var/local/mochilla/sparrow/templates.py", line 266, in
render_skeleton
    body, cmds_array = compile_templates(location, kwargs)
  File "/var/local/mochilla/sparrow/templates.py", line 192, in
compile_templates
    doc = get_uri(location)
  File "/var/local/mochilla/sparrow/uri.py", line 31, in get_uri
    selected = db.session.query(TemplateRelation).filter_by(location=uri)[0]
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
844, in __getitem__
    return list(self[item:item+1])[0]
IndexError: list index out of range




127.0.0.1 - - [05/Jun/2008:22:15:44] "GET / HTTP/1.0" 500 3293 "" ""
[05/Jun/2008:22:15:59] HTTP Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line
550, in respond
    cherrypy.response.body = self.handler()
  File "/var/lib/python-support/python2.5/cherrypy/_cpdispatch.py", line
24, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/var/local/mochilla/sparrow/http.py", line 38, in default
    return render(args, kwargs, location_st)
  File "/var/local/mochilla/sparrow/templates.py", line 363, in render
    return render_skeleton(location, location_st, kwargs)
  File "/var/local/mochilla/sparrow/templates.py", line 266, in
render_skeleton
    body, cmds_array = compile_templates(location, kwargs)
  File "/var/local/mochilla/sparrow/templates.py", line 252, in
compile_templates
    data = search_list(doc.oid, doc.objects, location=location,
locations=locations, cmds_array=doc.cmds_array, kwargs=kwargs)
  File "/var/local/mochilla/sparrow/templates.py", line 172, in search_list
    objects = object_children(object_oid)
  File "/var/local/mochilla/sparrow/objects.py", line 39, in object_children
    parent = get_object(oid)
  File "/var/local/mochilla/sparrow/objects.py", line 31, in get_object
    selected = db.session.query(Objects).filter_by(oid=oid).one()
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
927, in one
    raise exceptions.InvalidRequestError('No rows returned for one()')
InvalidRequestError: No rows returned for one()




127.0.0.1 - - [05/Jun/2008:18:15:08] "GET / HTTP/1.0" 200 24400 "" ""
[05/Jun/2008:18:15:09] HTTP Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line
550, in respond
    cherrypy.response.body = self.handler()
  File "/var/lib/python-support/python2.5/cherrypy/_cpdispatch.py", line
24, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/var/lib/python-support/python2.5/cherrypy/_cptools.py", line
140, in handle_func
    handled = self.callable(*args, **self._merged_args(kwargs))
TypeError: staticfile() got multiple values for keyword argument 'filename'




class 'sqlalchemy.exceptions.NoSuchColumnError'>
[05/Jun/2008:21:42:22] HTTP Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line
550, in respond
    cherrypy.response.body = self.handler()
  File "/var/lib/python-support/python2.5/cherrypy/_cpdispatch.py", line
24, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/var/local/mochilla/sparrow/http.py", line 38, in default
    return render(args, kwargs, location_st)
  File "/var/local/mochilla/sparrow/templates.py", line 346, in render
    get_uri(location_id)
  File "/var/local/mochilla/sparrow/uri.py", line 31, in get_uri
    selected = db.session.query(TemplateRelation).filter_by(location=uri)[0]
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
844, in __getitem__
    return list(self[item:item+1])[0]
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
986, in iterate_instances
    rows = [process[0](context, row) for row in fetch]
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
1551, in main
    extension=context.extension,
only_load_props=context.only_load_props,
refresh_instance=context.refresh_instance
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/mapper.py",
line 1380, in _instance
    identitykey = self.identity_key_from_row(row)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/mapper.py",
line 915, in identity_key_from_row
    return (self._identity_class, tuple([row[column] for column in
self.primary_key]), self.entity_name)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 1339, in __getitem__
    return self.__parent._get_col(self.__row, key)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 1594, in _get_col
    type_, processor, index = self._key_cache[key]
  File "/var/lib/python-support/python2.5/sqlalchemy/util.py", line 113,
in __missing__
    self[key] = val = self.creator(key)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 1491, in lookup_key
    raise exceptions.NoSuchColumnError("Could not locate column in row
for column '%s'" % (str(key)))
NoSuchColumnError: "Could not locate column in row for column
'template_relations.location'"





[05/Jun/2008:04:49:50] HTTP Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line
550, in respond
    cherrypy.response.body = self.handler()
  File "/var/lib/python-support/python2.5/cherrypy/_cpdispatch.py", line
24, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/var/local/mochilla/sparrow/http.py", line 38, in default
    return render(args, kwargs, location_st)
  File "/var/local/mochilla/sparrow/templates.py", line 363, in render
    return render_skeleton(location, location_st, kwargs)
  File "/var/local/mochilla/sparrow/templates.py", line 266, in
render_skeleton
    body, cmds_array = compile_templates(location, kwargs)
  File "/var/local/mochilla/sparrow/templates.py", line 253, in
compile_templates
    body =
render_template(settings.root.views_path+"/"+doc.template.source, data)
  File "/var/local/mochilla/sparrow/templates.py", line 187, in
render_template
    return t.respond()
  File "_var_local_mochilla_templates_table_of_contents_shop_tmpl.py",
line 92, in respond
  File "/var/local/mochilla/sparrow/order.py", line 62, in sort_by_order
    obj.order[0]
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/attributes.py",
line 44, in __get__
    return self.impl.get(instance._state)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/attributes.py",
line 217, in get
    def sethasparent(self, state, value):
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/strategies.py",
line 471, in __call__
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
687, in all
    currenttables.append(join.right)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
748, in __iter__
    raise exceptions.InvalidRequestError("Self-referential query on '%s'
property requires aliased=True argument." % str(prop))
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
751, in _execute_and_instances
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/session.py",
line 535, in execute
    """Commit the current transaction in progress.
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 844, in execute
    return Connection.executors[c](self, object, multiparams, params)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 895, in execute_clauseelement
    return self._execute_compiled(elem.compile(dialect=self.dialect,
column_keys=keys, inline=len(params) > 1), distilled_params=params)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 904, in _execute_compiled
    context = self.__create_execution_context(compiled=compiled,
parameters=distilled_params)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 941, in __create_execution_context
    self.close()
  File
"/var/lib/python-support/python2.5/sqlalchemy/databases/mysql.py", line
1458, in create_execution_context
    if ssl:
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/default.py",
line 179, in __init__
    self.cursor = self.create_cursor()
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/default.py",
line 275, in create_cursor
    def create_cursor(self):
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 583, in connection
    self.__invalid = False
InvalidRequestError: Can't reconnect until invalid transaction is rolled
back





127.0.0.1 - - [05/Jun/2008:06:19:56] "GET / HTTP/1.0" 500 1911 "" ""
[05/Jun/2008:06:19:56] HTTP Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line
550, in respond
    cherrypy.response.body = self.handler()
  File "/var/lib/python-support/python2.5/cherrypy/_cpdispatch.py", line
24, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/var/local/mochilla/sparrow/http.py", line 38, in default
    return render(args, kwargs, location_st)
  File "/var/local/mochilla/sparrow/templates.py", line 363, in render
    return render_skeleton(location, location_st, kwargs)
  File "/var/local/mochilla/sparrow/templates.py", line 266, in
render_skeleton
    body, cmds_array = compile_templates(location, kwargs)
  File "/var/local/mochilla/sparrow/templates.py", line 192, in
compile_templates
    doc = get_uri(location)
  File "/var/local/mochilla/sparrow/uri.py", line 31, in get_uri
    selected = db.session.query(TemplateRelation).filter_by(location=uri)[0]
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
844, in __getitem__
    return list(self[item:item+1])[0]
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
936, in __iter__
    return self._execute_and_instances(context)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
939, in _execute_and_instances
    result = self.session.execute(querycontext.statement,
params=self._params, mapper=self.mapper, instance=self._refresh_instance)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/session.py",
line 625, in execute
    return self.__connection(engine,
close_with_result=True).execute(clause, params or {})
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 844, in execute
    return Connection.executors[c](self, object, multiparams, params)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 895, in execute_clauseelement
    return self._execute_compiled(elem.compile(dialect=self.dialect,
column_keys=keys, inline=len(params) > 1), distilled_params=params)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 907, in _execute_compiled
    self.__execute_raw(context)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 916, in __execute_raw
    self._cursor_execute(context.cursor, context.statement,
context.parameters[0], context=context)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 960, in _cursor_execute
    self._handle_dbapi_exception(e, statement, parameters, cursor)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
844, in __getitem__
    return list(self[item:item+1])[0]
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
936, in __iter__
    return self._execute_and_instances(context)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line
939, in _execute_and_instances
    result = self.session.execute(querycontext.statement,
params=self._params, mapper=self.mapper, instance=self._refresh_instance)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/session.py",
line 625, in execute
    return self.__connection(engine,
close_with_result=True).execute(clause, params or {})
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 844, in execute
    return Connection.executors[c](self, object, multiparams, params)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 895, in execute_clauseelement
    return self._execute_compiled(elem.compile(dialect=self.dialect,
column_keys=keys, inline=len(params) > 1), distilled_params=params)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 907, in _execute_compiled
    self.__execute_raw(context)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 916, in __execute_raw
    self._cursor_execute(context.cursor, context.statement,
context.parameters[0], context=context)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 960, in _cursor_execute
    self._handle_dbapi_exception(e, statement, parameters, cursor)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
line 942, in _handle_dbapi_exception
    raise exceptions.DBAPIError.instance(statement, parameters, e,
connection_invalidated=is_disconnect)
OperationalError: (OperationalError) (2013, 'Lost connection to MySQL
server during query') u'SELECT template_relations.location AS
template_relations_location, template_relati\
ons.oid AS template_relations_oid, template_relations.vid AS
template_relations_vid, template_relations.children AS
template_relations_children \nFROM template_relations \nWHER\
E template_relations.location = %s ORDER BY template_relations.location
\n LIMIT 0, 1' ['r']











--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to