def sqlite2numpy(typename, size=None):
    """
    We can't use this yet....

    Convert a column type declaration from sqlite to a numpy data type.
    Determine sizes as best as possible from the declaration, or use the
    sizes= keyword to set sizes explicitly.

    We have to deal with some limitations.  Primarily:
        1) sqlite columns have no data type.
        2) numpy fields are fixed length.

    In sqlite, columns don't actually have data types.  When data are inserted
    the type is determined at run time and storage is determined based on
    the value.

    So integers are stored in a variable length encoding.  Even if a column is
    declared i4 it can store 8 bytes.  The actual storage depends on the value
    of the data.

    But if a column is declared to have specific size, we will honor this and
    assume the user knows what they are doing.  Since "integer" is how most
    people will declare all integer columns, we cannot be tempted to assign
    this 4 bytes.  Rather we will require explicit declaration of size.  We
    will honor tinyint,smallint,bigint as well but these are less clear.

    This goes for floating point too.  Internally, all floating point values
    are stored as 8 byte.  So we reqire an identifier such as f4 or f8, float
    or double.

    Note for text fields, which have no practical limit, a similar principle
    will hold.  If a field is simply declaed as "text" we must determine the
    size from the first row.  But if a size is specifically declared, we will
    honor it.  Note, character varying is treated like a text field.  Since
    n is meant to be a maximum size, this could potentially waste a lot of
    space, so we will guess from the first row.

        declared type           numpy conversion
        ----------------------------------------------------------
        text:                       S  size determined from the first result
        real:                       f8
        integer:                    i8

        f4, float32, float:         f4
        f8, float64, double:        f8

        i1, int8,  tinyint:         i1
        i2, int16, smallint:        i2
        i4, int32                   i4
        i8, int64, bigint:          i8

        char(n), character(n):      Sn
        varchar(n), character varying(n), character, char, string:
                                    S  size determined from the first result

    """
    typename = typename.strip().lower()
    if typename in ['i1', 'int8', 'tinyint']:
        return 'i1'
    elif typename in ['i2', 'int16', 'smallint']:
        return 'i2'
    elif typename in ['i4', 'int32']:
        return 'i4'
    elif typename in ['i8', 'int64', 'bigint', 'int', 'integer']:
        return 'i8'
    elif typename in ['f4', 'float32', 'float']:
        return 'f4'
    elif typename in ['f8', 'float64', 'double', 'real']:
        return 'f8'
    else:
        if size is not None:
            try:
                szint = int(size)
            except ValueError:
                raise ValueError("could not convert input size '%s' to int" %
                    size)
            return 'S%d' % szint
        if typename in ['char', 'character', 'text', 'string']:
            return 'S?'
        if typename.find('varying') != -1 or typename.find('varchar') != -1:
            return 'S?'
        left = typename.find('(')
        if left != -1:
            right = typename.find(')')
            if right != -1:
                substr = typename[left + 1:right]
                try:
                    szint = int(substr)
                except ValueError:
                    raise ValueError(
                        "could not convert size indicator '%s' to int in" %
                        typename)
                return 'S%d' % szint
        raise ValueError("Unable to convert type name: '%s'" % typename)
