예제 #1
0
def test_denormalize_quote_join():
    sfdialect = base.dialect()

    test_data = [
        (['abc', 'cde'], 'abc.cde'),
        (['abc.cde', 'def'], 'abc.cde.def'),
        (['"Abc".cde', 'def'], '"Abc".cde.def'),
        (['"Abc".cde', '"dEf"'], '"Abc".cde."dEf"'),
    ]
    for ts in test_data:
        assert sfdialect._denormalize_quote_join(*ts[0]) == ts[1]
def test_denormalize_quote_join():
    sfdialect = base.dialect()

    test_data = [
        (['abc', 'cde'], 'abc.cde'),
        (['abc.cde', 'def'], 'abc.cde.def'),
        (['"Abc".cde', 'def'], '"Abc".cde.def'),
        (['"Abc".cde', '"dEf"'], '"Abc".cde."dEf"'),

    ]
    for idx, ts in enumerate(test_data):
        assert sfdialect._denormalize_quote_join(*ts[0]) == ts[1]
예제 #3
0
def test_create_connect_args():
    sfdialect = base.dialect()

    test_data = [
        (
            # 0: full host name and no account
            URL("snowflake",
                username="******",
                password="******",
                host='testaccount.snowflakecomputing.com',
                query={}),
            {
                'autocommit': False,
                'host': 'testaccount.snowflakecomputing.com',
                'password': '******',
                'user': '******'
            }),
        (
            # 1: account name only
            URL("snowflake",
                username="******",
                password="******",
                host='testaccount',
                query={}),
            {
                'autocommit': False,
                'host': 'testaccount.snowflakecomputing.com',
                'password': '******',
                'user': '******',
                'port': '443',
                'account': 'testaccount'
            }),
        (
            # 2: account name including region
            URL("snowflake",
                username="******",
                password="******",
                host='testaccount.eu-central-1',
                query={}),
            {
                'autocommit': False,
                'host': 'testaccount.eu-central-1.snowflakecomputing.com',
                'password': '******',
                'user': '******',
                'port': '443',
                'account': 'testaccount'
            }),
        (
            # 3: full host including region
            URL("snowflake",
                username="******",
                password="******",
                host='testaccount.eu-central-1.snowflakecomputing.com',
                query={}),
            {
                'autocommit': False,
                'host': 'testaccount.eu-central-1.snowflakecomputing.com',
                'password': '******',
                'user': '******'
            }),
        (
            # 4: full host including region and account
            URL("snowflake",
                username="******",
                password="******",
                host='testaccount.eu-central-1.snowflakecomputing.com',
                query={'account': 'testaccount'}),
            {
                'autocommit': False,
                'host': 'testaccount.eu-central-1.snowflakecomputing.com',
                'password': '******',
                'user': '******',
                'account': 'testaccount'
            }),
        (
            # 5: full host including region and account including region
            URL("snowflake",
                username="******",
                password="******",
                host='testaccount.eu-central-1.snowflakecomputing.com',
                query={'account': 'testaccount.eu-central-1'}),
            {
                'autocommit': False,
                'host': 'testaccount.eu-central-1.snowflakecomputing.com',
                'password': '******',
                'user': '******',
                'account': 'testaccount.eu-central-1'
            }),
        (
            # 6: full host including region and account including region
            URL("snowflake",
                username="******",
                password="******",
                host='snowflake.reg.local',
                port='8082',
                query={'account': 'testaccount'}),
            {
                'autocommit': False,
                'host': 'snowflake.reg.local',
                'password': '******',
                'user': '******',
                'port': 8082,
                'account': 'testaccount'
            }),
        (
            # 7: Global URL
            URL("snowflake",
                username="******",
                password="******",
                host='testaccount-hso894gsiuafdhsaj935.global'),
            {
                'autocommit': False,
                'host':
                'testaccount-hso894gsiuafdhsaj935.global.snowflakecomputing.com',
                'password': '******',
                'user': '******',
                'port': '443',
                'account': 'testaccount'
            }),
    ]

    for idx, ts in enumerate(test_data):
        _, opts = sfdialect.create_connect_args(ts[0])
        assert opts == ts[1], "Failed: {0}: {1}".format(idx, ts[0])
def test_create_connect_args():
    sfdialect = base.dialect()

    test_data = [
        (
            # 0: full host name and no account
            URL("snowflake", username="******", password="******",
                host='testaccount.snowflakecomputing.com', query={}),
            {'autocommit': False,
             'host': 'testaccount.snowflakecomputing.com',
             'password': '******', 'user': '******'}
        ),
        (
            # 1: account name only
            URL("snowflake", username="******", password="******",
                host='testaccount', query={}),
            {'autocommit': False,
             'host': 'testaccount.snowflakecomputing.com',
             'password': '******', 'user': '******', 'port': '443',
             'account': 'testaccount'}
        ),
        (
            # 2: account name including region
            URL("snowflake", username="******", password="******",
                host='testaccount.eu-central-1', query={}),
            {'autocommit': False,
             'host': 'testaccount.eu-central-1.snowflakecomputing.com',
             'password': '******', 'user': '******', 'port': '443',
             'account': 'testaccount'}
        ),
        (
            # 3: full host including region
            URL("snowflake", username="******", password="******",
                host='testaccount.eu-central-1.snowflakecomputing.com',
                query={}),
            {'autocommit': False,
             'host': 'testaccount.eu-central-1.snowflakecomputing.com',
             'password': '******', 'user': '******'}
        ),
        (
            # 4: full host including region and account
            URL("snowflake", username="******", password="******",
                host='testaccount.eu-central-1.snowflakecomputing.com',
                query={'account': 'testaccount'}),
            {'autocommit': False,
             'host': 'testaccount.eu-central-1.snowflakecomputing.com',
             'password': '******', 'user': '******',
             'account': 'testaccount'}
        ),
        (
            # 5: full host including region and account including region
            URL("snowflake", username="******", password="******",
                host='testaccount.eu-central-1.snowflakecomputing.com',
                query={'account': 'testaccount.eu-central-1'}),
            {'autocommit': False,
             'host': 'testaccount.eu-central-1.snowflakecomputing.com',
             'password': '******', 'user': '******',
             'account': 'testaccount.eu-central-1'}
        ),
        (
            # 6: full host including region and account including region
            URL("snowflake", username="******", password="******",
                host='snowflake.reg.local', port='8082',
                query={'account': 'testaccount'}),
            {'autocommit': False,
             'host': 'snowflake.reg.local',
             'password': '******', 'user': '******', 'port': 8082,
             'account': 'testaccount'}
        ),
    ]

    for idx, ts in enumerate(test_data):
        _, opts = sfdialect.create_connect_args(ts[0])
        assert opts == ts[1], "Failed: {0}: {1}".format(idx, ts[0])