# Path: impala/interface.py
# def _bind_parameters(operation, parameters, paramstyle=None):
#     # If parameters is a list, assume either qmark, format, or numeric
#     # format. If not, assume either named or pyformat parameters
#     if isinstance(parameters, (list, tuple)):
#         return _bind_parameters_list(operation, parameters, paramstyle)
#     elif isinstance(parameters, dict):
#         return _bind_parameters_dict(operation, parameters)
#     else:
#         raise ProgrammingError("Query parameters argument should be a "
#                                "list, tuple, or dict object")
# 
# Path: impala/dbapi.py
# AUTH_MECHANISMS = ['NOSASL', 'PLAIN', 'GSSAPI', 'LDAP', 'JWT']
# STRING = _DBAPITypeObject('STRING')
# BINARY = _DBAPITypeObject('BINARY')
# NUMBER = _DBAPITypeObject('BOOLEAN', 'TINYINT', 'SMALLINT', 'INT', 'BIGINT',
#                           'FLOAT', 'DOUBLE', 'DECIMAL')
# DATETIME = _DBAPITypeObject('TIMESTAMP')
# DATE = _DBAPITypeObject('DATE')
# ROWID = _DBAPITypeObject()
# def connect(host='localhost', port=21050, database=None, timeout=None,
#             use_ssl=False, ca_cert=None, auth_mechanism='NOSASL', user=None,
#             password=None, kerberos_service_name='impala', use_ldap=None,
#             ldap_user=None, ldap_password=None, use_kerberos=None,
#             protocol=None, krb_host=None, use_http_transport=False,
#             http_path='', auth_cookie_names=None, http_cookie_names=None,
#             retries=3, jwt=None):
#     def __init__(self, *values):
#     def __cmp__(self, other):
#     def __eq__(self, other):
# def DateFromTicks(ticks):
# def TimeFromTicks(ticks):
# def TimestampFromTicks(ticks):
# class _DBAPITypeObject(object):


from pytest import raises
from impala.interface import _bind_parameters
from impala.dbapi import ProgrammingError
    import datetime
    dt("select * from test where str = 'foo'",
       "select * from test where str = %(str)s",
       {'str': "foo"})
    dt("select * from test where flt = 0.123",
       "select * from test where flt = %(flt)s",
       {'flt': 0.123})
    dt("select * from test where nul = NULL",
       "select * from test where nul = %(nul)s",
       {'nul': None})
    dt("select * from test where int = 1 and str = 'foo' and " +
       "flt = 0.123 and nul = NULL",
       "select * from test where int = %(int)s and str = " +
       "%(str)s and flt = %(flt)s and nul = %(nul)s",
       {'int': 1, 'str': "foo", 'flt': 0.123, 'nul': None})
    # Make sure parameters are not replaced twice
    dt("select * from test where a=':b' and b=':c' and c=':a'",
       "select * from test where a=%(a)s and b=%(b)s and c=%(c)s",
       {'a': ":b", 'b': ":c", 'c': ":a"})
    # Unused parameters should be fine
    dt("select * from test where a=1",
       "select * from test where a=1",
       {'unused': 3})
    # But nonexistent should not
    with raises(KeyError):
        dt("select * from test where int = 1",
           "select * from test where int = %(nosuchkeyword)s",
           {'wrong': 1})


def test_named():

# Path: impala/interface.py
# def _bind_parameters(operation, parameters, paramstyle=None):
#     # If parameters is a list, assume either qmark, format, or numeric
#     # format. If not, assume either named or pyformat parameters
#     if isinstance(parameters, (list, tuple)):
#         return _bind_parameters_list(operation, parameters, paramstyle)
#     elif isinstance(parameters, dict):
#         return _bind_parameters_dict(operation, parameters)
#     else:
#         raise ProgrammingError("Query parameters argument should be a "
#                                "list, tuple, or dict object")
# 
# Path: impala/dbapi.py
# AUTH_MECHANISMS = ['NOSASL', 'PLAIN', 'GSSAPI', 'LDAP', 'JWT']
# STRING = _DBAPITypeObject('STRING')
# BINARY = _DBAPITypeObject('BINARY')
# NUMBER = _DBAPITypeObject('BOOLEAN', 'TINYINT', 'SMALLINT', 'INT', 'BIGINT',
#                           'FLOAT', 'DOUBLE', 'DECIMAL')
# DATETIME = _DBAPITypeObject('TIMESTAMP')
# DATE = _DBAPITypeObject('DATE')
# ROWID = _DBAPITypeObject()
# def connect(host='localhost', port=21050, database=None, timeout=None,
#             use_ssl=False, ca_cert=None, auth_mechanism='NOSASL', user=None,
#             password=None, kerberos_service_name='impala', use_ldap=None,
#             ldap_user=None, ldap_password=None, use_kerberos=None,
#             protocol=None, krb_host=None, use_http_transport=False,
#             http_path='', auth_cookie_names=None, http_cookie_names=None,
#             retries=3, jwt=None):
#     def __init__(self, *values):
#     def __cmp__(self, other):
#     def __eq__(self, other):
# def DateFromTicks(ticks):
# def TimeFromTicks(ticks):
# def TimestampFromTicks(ticks):
# class _DBAPITypeObject(object):


# Path: impala/tests/test_query_parameters.py
from pytest import raises
from impala.interface import _bind_parameters
from impala.dbapi import ProgrammingError
    import datetime

    dt("select * from test where str = 'foo'",
       "select * from test where str = %(str)s",
       {'str': "foo"})
    dt("select * from test where flt = 0.123",
       "select * from test where flt = %(flt)s",
       {'flt': 0.123})
    dt("select * from test where nul = NULL",
       "select * from test where nul = %(nul)s",
       {'nul': None})
    dt("select * from test where int = 1 and str = 'foo' and " +
       "flt = 0.123 and nul = NULL",
       "select * from test where int = %(int)s and str = " +
       "%(str)s and flt = %(flt)s and nul = %(nul)s",
       {'int': 1, 'str': "foo", 'flt': 0.123, 'nul': None})
    # Make sure parameters are not replaced twice
    dt("select * from test where a=':b' and b=':c' and c=':a'",
       "select * from test where a=%(a)s and b=%(b)s and c=%(c)s",
       {'a': ":b", 'b': ":c", 'c': ":a"})
    # Unused parameters should be fine
    dt("select * from test where a=1",
       "select * from test where a=1",
       {'unused': 3})
    # But nonexistent should not
    with raises(KeyError):
        dt("select * from test where int = 1",
           "select * from test where int = %(nosuchkeyword)s",
           {'wrong': 1})


def test_named():

    dt("select * from test where int = 1",