def sqla_datatype_for(datum):
    """
    Given a scalar Python value, picks an appropriate SQLAlchemy data type.

    >>> sqla_datatype_for(7.2)
    DECIMAL(precision=2, scale=1)
    >>> sqla_datatype_for("Jan 17 2012")
    <class 'sqlalchemy.sql.sqltypes.DATETIME'>
    >>> sqla_datatype_for("something else")
    Unicode(length=14)
    """
    try:
        if len(_complex_enough_to_be_date.findall(datum)) > 1:
            dateutil.parser.parse(datum)
            return sa.DATETIME
    except (TypeError, ValueError):
        pass
    try:
        (prec, scale) = precision_and_scale(datum)
        return sa.DECIMAL(prec, scale)
    except TypeError:
        return sa.Unicode(len(datum))
def sqla_datatype_for ( datum ) : try : if len ( _complex_enough_to_be_date . findall ( datum ) ) > 1 : dateutil . parser . parse ( datum ) return sa . DATETIME except ( TypeError , ValueError ) : pass try : ( prec , scale ) = precision_and_scale ( datum ) return sa . DECIMAL ( prec , scale ) except TypeError : return sa . Unicode ( len ( datum ) )
Given a scalar Python value, picks an appropriate SQLAlchemy data type.

    >>> sqla_datatype_for(7.2)
    DECIMAL(precision=2, scale=1)
    >>> sqla_datatype_for("Jan 17 2012")
    <class 'sqlalchemy.sql.sqltypes.DATETIME'>
    >>> sqla_datatype_for("something else")
    Unicode(length=14)