def create_hive_statement(tbl_name, dshape, path=None, table_type='',
        db_name='default', stored_as='TEXTFILE', **kwargs):
    """ Generic CREATE TABLE statement for hive

    Parameters
    ----------

    tbl_name : string
        Specifies table name "mytable"
    dshape : DataShape
        Datashape of the desired table
    path : string (optional)
        Location of data
    table_type : string (optional)
        Table Modifier like EXTERNAL or LOCAL
    db_name : string
        Specifies database name.  Defaults to "default"
    stored_as: string
        Target storage format like TEXTFILE or PARQUET

    **kwargs: keyword arguments dict
        CSV dialect with keys delimiter, has_header, etc.

    Example
    -------

    >>> from datashape import dshape
    >>> ds = dshape('var * {name: string, balance: int64, when: datetime}')
    >>> print(create_hive_statement('accounts', ds, delimiter=','))  # doctest: +NORMALIZE_WHITESPACE
    CREATE  TABLE default.accounts (
            name  STRING,
         balance  BIGINT,
            when  TIMESTAMP
    )
    ROW FORMAT DELIMITED
        FIELDS TERMINATED BY ','
    STORED AS TEXTFILE

    >>> print(create_hive_statement('accounts', ds, delimiter=',',
    ...         has_header=True, path='/data/accounts/', table_type='EXTERNAL'))  # doctest: +NORMALIZE_WHITESPACE
    CREATE EXTERNAL TABLE default.accounts (
            name  STRING,
         balance  BIGINT,
            when  TIMESTAMP
    )
    ROW FORMAT DELIMITED
        FIELDS TERMINATED BY ','
    STORED AS TEXTFILE
    LOCATION '/data/accounts/'
    TBLPROPERTIES ("skip.header.line.count"="1")

    >>> print(create_hive_statement('accounts', ds, stored_as='PARQUET'))  # doctest: +NORMALIZE_WHITESPACE
    CREATE  TABLE default.accounts (
            name  STRING,
         balance  BIGINT,
            when  TIMESTAMP
    )
    STORED AS PARQUET
    """
    if db_name:
        db_name = db_name + '.'

    if not table_type:
        table_type = ''

    # Column names and types from datashape
    assert isinstance(dshape.measure, ct.Record)
    columns = dshape_to_hive(dshape)
    column_text = ',\n    '.join('%20s  %s' % tuple(col.split())
                                 for col in columns).lstrip()

    statement = """
        CREATE {table_type} TABLE {db_name}{tbl_name} (
            {column_text}
        )
        """

    if kwargs in 'delimiter':
        statement += """
        ROW FORMAT DELIMITED
            FIELDS TERMINATED BY '{delimiter}'
        """

    statement += """
        STORED AS {stored_as}
        """

    if path:
        statement = statement +"""
        LOCATION '{path}'
        """

    if kwargs.get('has_header'):
        statement = statement + """
        TBLPROPERTIES ("skip.header.line.count"="1")"""

    return statement.format(**merge(kwargs, locals())).strip('\n')
dataset/ETHPy150Open blaze/odo/odo/backends/hdfs.py/create_hive_statement/swapped operands of `in`