commit/galaxy-central: natefoo: Monkeypatch BigInt(eger) into SQLAlchemy 0.5 and make the bytes column in the quota table a bigint.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/d6fa346d5460/ changeset: d6fa346d5460 user: natefoo date: 2011-08-18 17:08:47 summary: Monkeypatch BigInt(eger) into SQLAlchemy 0.5 and make the bytes column in the quota table a bigint. affected #: 3 files (1.8 KB) --- a/lib/galaxy/model/custom_types.py Wed Aug 17 16:32:09 2011 -0400 +++ b/lib/galaxy/model/custom_types.py Thu Aug 18 11:08:47 2011 -0400 @@ -8,6 +8,11 @@ from galaxy.util.bunch import Bunch from galaxy.util.aliaspickler import AliasPickleModule +# For monkeypatching BIGINT +import sqlalchemy.databases.sqlite +import sqlalchemy.databases.postgres +import sqlalchemy.databases.mysql + import logging log = logging.getLogger( __name__ ) @@ -87,3 +92,53 @@ value = value[0:self.impl.length] return value + +class BigInteger( Integer ): + """ + A type for bigger ``int`` integers. + + Typically generates a ``BIGINT`` in DDL, and otherwise acts like + a normal :class:`Integer` on the Python side. + + """ + +class BIGINT( BigInteger ): + """The SQL BIGINT type.""" + +class DBBigInteger( BigInteger ): + def get_col_spec( self ): + return "BIGINT" + +sqlalchemy.databases.postgres.PGBigInteger = DBBigInteger +sqlalchemy.databases.postgres.colspecs[BigInteger] = DBBigInteger +sqlalchemy.databases.sqlite.SLBigInteger = DBBigInteger +sqlalchemy.databases.sqlite.colspecs[BigInteger] = DBBigInteger + +class MSBigInteger( BigInteger, sqlalchemy.databases.mysql.MSInteger ): + """MySQL BIGINTEGER type.""" + + def __init__(self, display_width=None, **kw): + """Construct a BIGINTEGER. + + :param display_width: Optional, maximum display width for this number. + + :param unsigned: a boolean, optional. + + :param zerofill: Optional. If true, values will be stored as strings + left-padded with zeros. Note that this does not effect the values + returned by the underlying database API, which continue to be + numeric. + + """ + self.display_width = display_width + sqlalchemy.databases.mysql._NumericType.__init__(self, kw) + BigInteger.__init__(self, **kw) + + def get_col_spec(self): + if self.display_width is not None: + return self._extend("BIGINT(%(display_width)s)" % {'display_width': self.display_width}) + else: + return self._extend("BIGINT") + +sqlalchemy.databases.mysql.MSBigInteger = MSBigInteger +sqlalchemy.databases.mysql.colspecs[BigInteger] = MSBigInteger --- a/lib/galaxy/model/mapping.py Wed Aug 17 16:32:09 2011 -0400 +++ b/lib/galaxy/model/mapping.py Thu Aug 18 11:08:47 2011 -0400 @@ -217,7 +217,7 @@ Column( "update_time", DateTime, default=now, onupdate=now ), Column( "name", String( 255 ), index=True, unique=True ), Column( "description", TEXT ), - Column( "bytes", Integer ), + Column( "bytes", BigInteger ), Column( "operation", String( 8 ) ), Column( "deleted", Boolean, index=True, default=False ) ) --- a/lib/galaxy/model/migrate/versions/0080_quota_tables.py Wed Aug 17 16:32:09 2011 -0400 +++ b/lib/galaxy/model/migrate/versions/0080_quota_tables.py Thu Aug 18 11:08:47 2011 -0400 @@ -7,6 +7,7 @@ from migrate import * from migrate.changeset import * from galaxy.model.orm.ext.assignmapper import * +from galaxy.model.custom_types import * import datetime now = datetime.datetime.utcnow @@ -25,7 +26,7 @@ Column( "update_time", DateTime, default=now, onupdate=now ), Column( "name", String( 255 ), index=True, unique=True ), Column( "description", TEXT ), - Column( "bytes", Integer ), + Column( "bytes", BigInteger ), Column( "operation", String( 8 ) ), Column( "deleted", Boolean, index=True, default=False ) ) 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)
-
Bitbucket