sqlalchemy.FLOAT - python examples

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

3 Examples 7

3 View Complete Implementation : test_reflection.py
Copyright MIT License
Author : sqlalchemy
    def test_float_types(self):
        specs = [
            (DOUBLE_PRECISION(), FLOAT()),
            # when binary_precision is supported
            # (DOUBLE_PRECISION(), oracle.FLOAT(binary_precision=126)),
            (BINARY_DOUBLE(), BINARY_DOUBLE()),
            (BINARY_FLOAT(), BINARY_FLOAT()),
            (FLOAT(5), FLOAT()),
            # when binary_precision is supported
            # (FLOAT(5), oracle.FLOAT(binary_precision=5),),
            (FLOAT(), FLOAT()),
            # when binary_precision is supported
            # (FLOAT(5), oracle.FLOAT(binary_precision=126),),
        ]
        self._run_test(specs, ["precision"])

3 View Complete Implementation : f78c5b7d4a52_add_osm_solar_node_table.py
Copyright GNU General Public License v3.0
Author : typicalTYLER
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('solar_nodes',
    sa.Column('longitude', sa.FLOAT(), nullable=False),
    sa.Column('lasatude', sa.FLOAT(), nullable=False),
    sa.PrimaryKeyConstraint('longitude', 'lasatude', sqlite_on_conflict='IGNORE')
    )

0 View Complete Implementation : test_types.py
Copyright MIT License
Author : sqlalchemy
    @testing.provide_metadata
    def test_numerics(self):
        m = self.metadata
        t1 = Table(
            "t1",
            m,
            Column("intcol", Integer),
            Column("numericcol", Numeric(precision=9, scale=2)),
            Column("floatcol1", Float()),
            Column("floatcol2", FLOAT()),
            Column("doubleprec", oracle.DOUBLE_PRECISION),
            Column("numbercol1", oracle.NUMBER(9)),
            Column("numbercol2", oracle.NUMBER(9, 3)),
            Column("numbercol3", oracle.NUMBER),
        )
        t1.create()
        t1.insert().execute(
            intcol=1,
            numericcol=5.2,
            floatcol1=6.5,
            floatcol2=8.5,
            doubleprec=9.5,
            numbercol1=12,
            numbercol2=14.85,
            numbercol3=15.76,
        )

        m2 = MetaData(testing.db)
        t2 = Table("t1", m2, autoload=True)

        for row in (
            t1.select().execute().first(),
            t2.select().execute().first(),
        ):
            for i, (val, type_) in enumerate(
                (
                    (1, int),
                    (decimal.Decimal("5.2"), decimal.Decimal),
                    (6.5, float),
                    (8.5, float),
                    (9.5, float),
                    (12, int),
                    (decimal.Decimal("14.85"), decimal.Decimal),
                    (15.76, float),
                )
            ):
                eq_(row[i], val)
                astert isinstance(row[i], type_), "%r is not %r" % (
                    row[i],
                    type_,
                )