2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5315471299a9/ changeset: 5315471299a9 user: kellrott date: 2013-01-10 20:46:20 summary: Adding UUIDType to data model and uuid column to dataset table. affected #: 4 files
diff -r c015b82b3944f967e2c859d5552c00e3e38a2da0 -r 5315471299a992d4fd243fbb681e5caf65ff2092 lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -895,6 +895,7 @@ self.external_filename = external_filename self._extra_files_path = extra_files_path self.file_size = file_size + self.uuid = None
def get_file_name( self ): if not self.external_filename:
diff -r c015b82b3944f967e2c859d5552c00e3e38a2da0 -r 5315471299a992d4fd243fbb681e5caf65ff2092 lib/galaxy/model/custom_types.py --- a/lib/galaxy/model/custom_types.py +++ b/lib/galaxy/model/custom_types.py @@ -1,9 +1,11 @@ from sqlalchemy.types import * + import pkg_resources pkg_resources.require("simplejson") import simplejson import pickle import copy +import uuid import binascii from galaxy.util.bunch import Bunch from galaxy.util.aliaspickler import AliasPickleModule @@ -84,6 +86,39 @@ ret = None return ret
+ + +class UUIDType(TypeDecorator): + """ + Platform-independent UUID type. + + Based on http://docs.sqlalchemy.org/en/rel_0_8/core/types.html#backend-agnostic-guid-... + Changed to remove sqlalchemy 0.8 specific code + + CHAR(32), storing as stringified hex values. + """ + impl = CHAR + + def load_dialect_impl(self, dialect): + return dialect.type_descriptor(CHAR(32)) + + def process_bind_param(self, value, dialect): + if value is None: + return value + else: + if not isinstance(value, uuid.UUID): + return "%.32x" % uuid.UUID(value) + else: + # hexstring + return "%.32x" % value + + def process_result_value(self, value, dialect): + if value is None: + return value + else: + return uuid.UUID(value) + + class TrimmedString( TypeDecorator ): impl = String def process_bind_param( self, value, dialect ):
diff -r c015b82b3944f967e2c859d5552c00e3e38a2da0 -r 5315471299a992d4fd243fbb681e5caf65ff2092 lib/galaxy/model/mapping.py --- a/lib/galaxy/model/mapping.py +++ b/lib/galaxy/model/mapping.py @@ -135,7 +135,8 @@ Column( "external_filename" , TEXT ), Column( "_extra_files_path", TEXT ), Column( 'file_size', Numeric( 15, 0 ) ), - Column( 'total_size', Numeric( 15, 0 ) ) ) + Column( 'total_size', Numeric( 15, 0 ) ), + Column( 'uuid', UUIDType() ) )
HistoryDatasetAssociationDisplayAtAuthorization.table = Table( "history_dataset_association_display_at_authorization", metadata, Column( "id", Integer, primary_key=True ),
diff -r c015b82b3944f967e2c859d5552c00e3e38a2da0 -r 5315471299a992d4fd243fbb681e5caf65ff2092 lib/galaxy/model/migrate/versions/0110_add_dataset_uuid.py --- /dev/null +++ b/lib/galaxy/model/migrate/versions/0110_add_dataset_uuid.py @@ -0,0 +1,50 @@ +""" +Add UUID column to dataset table +""" + +from sqlalchemy import * +from sqlalchemy.orm import * +from migrate import * +from migrate.changeset import * +from galaxy.model.custom_types import UUIDType + +import logging +log = logging.getLogger( __name__ ) + +metadata = MetaData( migrate_engine ) +#db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) ) + +dataset_uuid_column = Column( "uuid", UUIDType, nullable=True ) + + +def display_migration_details(): + print "" + print "This migration adds uuid column to dataset table" + +def upgrade(): + print __doc__ + metadata.reflect() + + # Add the uuid colum to the dataset table + try: + dataset_table = Table( "dataset", metadata, autoload=True ) + dataset_uuid_column.create( dataset_table ) + assert dataset_uuid_column is dataset_table.c.uuid + except Exception, e: + print str(e) + log.error( "Adding column 'uuid' to dataset table failed: %s" % str( e ) ) + return + + +def downgrade(): + metadata.reflect() + + # Drop the Job table's exit_code column. + try: + dataset_table = Table( "dataset", metadata, autoload=True ) + dataset_uuid = dataset_table.c.uuid + dataset_uuid.drop() + except Exception, e: + log.debug( "Dropping 'uuid' column from dataset table failed: %s" % ( str( e ) ) ) + +
https://bitbucket.org/galaxy/galaxy-central/commits/d4d5588574cc/ changeset: d4d5588574cc user: dannon date: 2013-01-28 19:56:01 summary: Merged in kellrott/galaxy-central (pull request #105)
Adding UUIDType to data model and uuid column to dataset table. affected #: 4 files
diff -r b1a778e027ff330f044d44ca0ba1a07992d376b4 -r d4d5588574ccb7faea8abfb0f0ca9fe9b48e701e lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -895,6 +895,7 @@ self.external_filename = external_filename self._extra_files_path = extra_files_path self.file_size = file_size + self.uuid = None
def get_file_name( self ): if not self.external_filename:
diff -r b1a778e027ff330f044d44ca0ba1a07992d376b4 -r d4d5588574ccb7faea8abfb0f0ca9fe9b48e701e lib/galaxy/model/custom_types.py --- a/lib/galaxy/model/custom_types.py +++ b/lib/galaxy/model/custom_types.py @@ -1,9 +1,11 @@ from sqlalchemy.types import * + import pkg_resources pkg_resources.require("simplejson") import simplejson import pickle import copy +import uuid import binascii from galaxy.util.bunch import Bunch from galaxy.util.aliaspickler import AliasPickleModule @@ -84,6 +86,39 @@ ret = None return ret
+ + +class UUIDType(TypeDecorator): + """ + Platform-independent UUID type. + + Based on http://docs.sqlalchemy.org/en/rel_0_8/core/types.html#backend-agnostic-guid-... + Changed to remove sqlalchemy 0.8 specific code + + CHAR(32), storing as stringified hex values. + """ + impl = CHAR + + def load_dialect_impl(self, dialect): + return dialect.type_descriptor(CHAR(32)) + + def process_bind_param(self, value, dialect): + if value is None: + return value + else: + if not isinstance(value, uuid.UUID): + return "%.32x" % uuid.UUID(value) + else: + # hexstring + return "%.32x" % value + + def process_result_value(self, value, dialect): + if value is None: + return value + else: + return uuid.UUID(value) + + class TrimmedString( TypeDecorator ): impl = String def process_bind_param( self, value, dialect ):
diff -r b1a778e027ff330f044d44ca0ba1a07992d376b4 -r d4d5588574ccb7faea8abfb0f0ca9fe9b48e701e lib/galaxy/model/mapping.py --- a/lib/galaxy/model/mapping.py +++ b/lib/galaxy/model/mapping.py @@ -135,7 +135,8 @@ Column( "external_filename" , TEXT ), Column( "_extra_files_path", TEXT ), Column( 'file_size', Numeric( 15, 0 ) ), - Column( 'total_size', Numeric( 15, 0 ) ) ) + Column( 'total_size', Numeric( 15, 0 ) ), + Column( 'uuid', UUIDType() ) )
HistoryDatasetAssociationDisplayAtAuthorization.table = Table( "history_dataset_association_display_at_authorization", metadata, Column( "id", Integer, primary_key=True ),
diff -r b1a778e027ff330f044d44ca0ba1a07992d376b4 -r d4d5588574ccb7faea8abfb0f0ca9fe9b48e701e lib/galaxy/model/migrate/versions/0110_add_dataset_uuid.py --- /dev/null +++ b/lib/galaxy/model/migrate/versions/0110_add_dataset_uuid.py @@ -0,0 +1,50 @@ +""" +Add UUID column to dataset table +""" + +from sqlalchemy import * +from sqlalchemy.orm import * +from migrate import * +from migrate.changeset import * +from galaxy.model.custom_types import UUIDType + +import logging +log = logging.getLogger( __name__ ) + +metadata = MetaData( migrate_engine ) +#db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) ) + +dataset_uuid_column = Column( "uuid", UUIDType, nullable=True ) + + +def display_migration_details(): + print "" + print "This migration adds uuid column to dataset table" + +def upgrade(): + print __doc__ + metadata.reflect() + + # Add the uuid colum to the dataset table + try: + dataset_table = Table( "dataset", metadata, autoload=True ) + dataset_uuid_column.create( dataset_table ) + assert dataset_uuid_column is dataset_table.c.uuid + except Exception, e: + print str(e) + log.error( "Adding column 'uuid' to dataset table failed: %s" % str( e ) ) + return + + +def downgrade(): + metadata.reflect() + + # Drop the Job table's exit_code column. + try: + dataset_table = Table( "dataset", metadata, autoload=True ) + dataset_uuid = dataset_table.c.uuid + dataset_uuid.drop() + except Exception, e: + log.debug( "Dropping 'uuid' column from dataset table failed: %s" % ( str( e ) ) ) + +
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.
galaxy-commits@lists.galaxyproject.org