commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/1a35a5c06160/ Changeset: 1a35a5c06160 Branch: jjohnson/use-a-select-statement-to-reliably-retri-1418411766371 User: jjohnson Date: 2014-12-12 19:16:28+00:00 Summary: Use a SELECT statement to reliably retrieve table column names. Affected #: 1 file diff -r efd0286e7629289c4c583898ebecb32646834c64 -r 1a35a5c06160bbda373a3ccbdd0bf666a8817203 lib/galaxy/datatypes/binary.py --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -571,10 +571,19 @@ rslt = c.execute(tables_query).fetchall() for table,sql in rslt: tables.append(table) - columns[table] = re.sub('^.*\((.*)\)$','\\1',sql).split(',') + try: + col_query = 'SELECT * FROM %s LIMIT 0' % table + cur = conn.cursor().execute(col_query) + cols = [col[0] for col in cur.description] + columns[table] = cols + except Exception, exc: + log.warn( '%s, set_meta Exception: %s', self, exc ) for table in tables: - row_query = "SELECT count(*) FROM %s" % table - rowcounts[table] = c.execute(row_query).fetchone()[0] + try: + row_query = "SELECT count(*) FROM %s" % table + rowcounts[table] = c.execute(row_query).fetchone()[0] + except Exception, exc: + log.warn( '%s, set_meta Exception: %s', self, exc ) dataset.metadata.tables = tables dataset.metadata.table_columns = columns dataset.metadata.table_row_count = rowcounts https://bitbucket.org/galaxy/galaxy-central/commits/f369d51bdce0/ Changeset: f369d51bdce0 User: dannon Date: 2014-12-16 07:41:34+00:00 Summary: Merged in jjohnson/galaxy-central-8/jjohnson/use-a-select-statement-to-reliably-retri-1418411766371 (pull request #608) Use a SELECT statement to reliably retrieve table column names. Affected #: 1 file diff -r 7be7283d9355b12b016abdd59ce9733287ff3f50 -r f369d51bdce0b00d2d62528c81eab679bd2afc58 lib/galaxy/datatypes/binary.py --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -571,10 +571,19 @@ rslt = c.execute(tables_query).fetchall() for table,sql in rslt: tables.append(table) - columns[table] = re.sub('^.*\((.*)\)$','\\1',sql).split(',') + try: + col_query = 'SELECT * FROM %s LIMIT 0' % table + cur = conn.cursor().execute(col_query) + cols = [col[0] for col in cur.description] + columns[table] = cols + except Exception, exc: + log.warn( '%s, set_meta Exception: %s', self, exc ) for table in tables: - row_query = "SELECT count(*) FROM %s" % table - rowcounts[table] = c.execute(row_query).fetchone()[0] + try: + row_query = "SELECT count(*) FROM %s" % table + rowcounts[table] = c.execute(row_query).fetchone()[0] + except Exception, exc: + log.warn( '%s, set_meta Exception: %s', self, exc ) dataset.metadata.tables = tables dataset.metadata.table_columns = columns dataset.metadata.table_row_count = rowcounts Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org