funginstitute / patentprocessor

BSD 2-Clause "Simplified" License
68 stars 31 forks source link

**bug** new code (i believe related to claims) generates issues when parallelizing the scripts #56

Closed laironald closed 11 years ago

laironald commented 11 years ago

I receive the following errors when I process XML files in 2006/2007. for example: ipg070403.xml

/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py:459: SAWarning: Unicode type received non-unicode bind param value
  param.append(processors[key](compiled_params[key]))
Traceback (most recent call last):
  File "parse.py", line 176, in <module>
    main(PATENTROOT, XMLREGEX, VERBOSITY, PATENTOUTPUTDIR)
  File "parse.py", line 161, in main
    parse_files(files)
  File "parse.py", line 104, in parse_files
    alchemy.add(patobj)
  File "/home/sgeadmin/patentprocessor/lib/alchemy/__init__.py", line 115, in add
    session.merge(pat)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1518, in merge
    load=load, _recursive=_recursive)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1557, in _merge
    merged = self.query(mapper.class_).get(key[1])
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 805, in get
    return loading.load_on_ident(self, key)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 226, in load_on_ident
    return q.one()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2173, in one
    ret = list(self)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2216, in __iter__
    return self._execute_and_instances(context)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2231, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 662, in execute
    params)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 761, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 874, in _execute_context
    context)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 163, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 867, in _execute_context
    context)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 324, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
sqlalchemy.exc.OperationalError: (OperationalError) (1054, "Unknown column 'patent.num_claims' in 'field list'") 'SELECT patent.id AS patent_id, patent.type AS patent_type, patent.number AS patent_number, patent.country AS patent_country, patent.date AS patent_date, patent.kind AS patent_kind, patent.num_claims AS patent_num_claims \nFROM patent \nWHERE patent.id = %s' ('D540006',)
laironald commented 11 years ago

i think i resolved this problem. at least things seem ok right now.

gtfierro commented 11 years ago

Looks like this happened because I changed the schema of the Patent table: claims to num_claims so that I could have the foreign key relation claims, which was more semantically convenient. Why'd you close the issue though? Was it just on your local machine?

laironald commented 11 years ago

yes! i noticed that too so when i changed the schema to reflect this, it was fine!

On Tue, Aug 20, 2013 at 12:57 PM, Gabe Fierro notifications@github.comwrote:

Looks like this happened because I changed the schema of the Patent table: claims to num_claims so that I could have the foreign key relation claims, which was more semantically convenient. Why'd you close the issue though? Was it just on your local machine?

— Reply to this email directly or view it on GitHubhttps://github.com/funginstitute/patentprocessor/issues/56#issuecomment-22959965 .

sent from mobile