sqlalchemy.types.Float

Here are the examples of the python api sqlalchemy.types.Float taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: aiorest-ws Source File: test_fields.py
    def test_to_internal_value_for_default_field_with_processor(self):
        instance = fields.ModelField(Column(types.Float))
        self.assertEqual(instance.to_internal_value('10'), 10.0)

Example 2

Project: Flask-AppBuilder Source File: interface.py
Function: is_float
    def is_float(self, col_name):
        try:
            return isinstance(self.list_columns[col_name].type, sa.types.Float)
        except:
            return False

Example 3

Project: Camelot Source File: backup.py
    def get_backup_column_type( self, from_type ):
        """This function converts column types from the source database to
        to column types in the backup database.  This is needed when backing
        up from for example MySQL to SQLite, since column types differ between
        both databases.  Overwrite this method to support different columns 
        and/or database types.
        
        :param from_type: the column type in the database that is backed up
        :return: the corresponding column type in the back up database
        """
        from sqlalchemy.dialects.mysql import base as mysql_dialect
        from sqlalchemy.dialects import postgresql as postgresql_dialect  
        import sqlalchemy.types
        #
        # Postgresql
        #
        if isinstance( from_type, postgresql_dialect.DOUBLE_PRECISION ):
            return sqlalchemy.types.Float()
        if isinstance( from_type, postgresql_dialect.BYTEA ):
            return sqlalchemy.types.LargeBinary()        
        #
        # MySQL
        #
        if isinstance( from_type, mysql_dialect.TINYINT ):
            return sqlalchemy.types.Boolean()
        if isinstance( from_type, mysql_dialect._StringType ):
            return sqlalchemy.types.String()   
        if isinstance( from_type, mysql_dialect._FloatType ):
            return sqlalchemy.types.Float()
        return from_type