for row in result:
tool_shed_repository_id = row[0]
try:
repository_metadata = from_json_string( str( row[1] ) )
# Create a new row in the tool table for each tool included in repository. We will NOT
# handle tool_version_associaions because we do not have the information we need to do so.
tools = repository_metadata.get( 'tools', [] )
for tool_dict in tools:
cmd = "INSERT INTO tool_version VALUES (%s, %s, %s, '%s', %s)" % \
( nextval( 'tool_version' ), localtimestamp(), localtimestamp(), tool_dict[ 'guid' ], tool_shed_repository_id )
db_session.execute( cmd )
count += 1
except Exception, e:
print "Repository metadata: ", str( row[1] )
print "Exception setting tool versions for tools in tool_shed_repository with id: ", str( tool_shed_repository_id )
print str( e )
The lines of code you are replacing look like this:
for row in result:
if row[1]:
tool_shed_repository_id = row[0]
repository_metadata = from_json_string( str( row[1] ) )
# Create a new row in the tool table for each tool included in repository. We will NOT
# handle tool_version_associaions because we do not have the information we need to do so.
tools = repository_metadata.get( 'tools', [] )
for tool_dict in tools:
cmd = "INSERT INTO tool_version VALUES (%s, %s, %s, '%s', %s)" % \
( nextval( 'tool_version' ), localtimestamp(), localtimestamp(), tool_dict[ 'guid' ], tool_shed_repository_id )
db_session.execute( cmd )
count += 1
On Feb 6, 2012, at 5:23 PM, Anthonius deBoer wrote:
I manually dropped the tool_version and tool_association table in the database and I am left with the JSON error as shown below:
90 -> 91...
Migration script to create the tool_version and tool_version_association tables and drop the tool_id_guid_map table.
Traceback (most recent call last):
File "./scripts/manage_db.py", line 63, in <module>
main( repository=repo, url=db_url )
File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/shell.py", line 150, in main
ret = command_func(**kwargs)
File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/api.py", line 221, in upgrade
return _migrate(url, repository, version, upgrade=True, err=err, **opts)
File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/api.py", line 349, in _migrate
schema.runchange(ver, change, changeset.step)
File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/schema.py", line 184, in runchange
change.run(self.engine, step)
File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/script/py.py", line 101, in run
func()
File "lib/galaxy/model/migrate/versions/0091_add_tool_version_tables.py", line 78, in upgrade
repository_metadata = from_json_string( str( row[1] ) )
File "/home/tdeboer/code/galaxy-central/eggs/simplejson-2.1.1-py2.6-linux-x86_64-ucs2.egg/simplejson/__init__.py", line 384, in loads
File "/home/tdeboer/code/galaxy-central/eggs/simplejson-2.1.1-py2.6-linux-x86_64-ucs2.egg/simplejson/decoder.py", line 402, in decode
File "/home/tdeboer/code/galaxy-central/eggs/simplejson-2.1.1-py2.6-linux-x86_64-ucs2.egg/simplejson/decoder.py", line 420, in raw_decode
simplejson.decoder.JSONDecodeError: No JSON object could be decoded: line 1 column 0 (char 0)
On Feb 06, 2012, at 02:08 PM, Anthonius deBoer <
thondeboer@me.com> wrote:
Hi Greg,
I tried the downgrade/upgrade path and got the exact same message I sent before.
I am using a postgres database that is running on local host.
I did indeed install some toolshed repositories before I tried to upgrade.
I also tried to downgrade to 89 and then upgrade, with the exact same message.
Thon
On Feb 06, 2012, at 10:51 AM, Greg Von Kuster <
greg@bx.psu.edu> wrote:
Hello Thon,
Attempting to run the migration script twice to the same version always poses problems. Can you downgrade successfully as follows?
sh manage_db.sh downgrade 90
If so, downgrade, then upgrade again a