Commit e61ed976 authored by Mark Heppner's avatar Mark Heppner

Remove Avatica version handling, move protobuf classes

parent fd2e3961
#!/usr/bin/env bash
export CALCITE_VER=calcite-1.8.0
export CALCITE_DIR=calcite1_8
export CALCITE_DIR=calcite
rm -rf phoenixdb/schema/$CALCITE_DIR
rm -rf calcite-tmp
......@@ -14,10 +14,9 @@ echo "avatica/core/src/main/protobuf/*" >> .git/info/sparse-checkout
git pull --depth=1 origin $CALCITE_VER
cd ..
mkdir -p phoenixdb/schema/$CALCITE_DIR
protoc --proto_path=calcite-tmp/avatica/core/src/main/protobuf/ --python_out=phoenixdb/schema/$CALCITE_DIR calcite-tmp/avatica/core/src/main/protobuf/*.proto
mkdir -p phoenixdb/$CALCITE_DIR
protoc --proto_path=calcite-tmp/avatica/core/src/main/protobuf/ --python_out=phoenixdb/$CALCITE_DIR calcite-tmp/avatica/core/src/main/protobuf/*.proto
rm -rf calcite-tmp
echo '' >> phoenixdb/schema/__init__.py
echo '' >> phoenixdb/schema/$CALCITE_DIR/__init__.py
echo '' >> phoenixdb/$CALCITE_DIR/__init__.py
......@@ -18,7 +18,6 @@ import re
import socket
import httplib
import pprint
import json
import math
import logging
import urlparse
......@@ -26,8 +25,7 @@ import time
from decimal import Decimal
from HTMLParser import HTMLParser
from phoenixdb import errors
# TODO conditionally import based on the connection string
from phoenixdb.schema.calcite1_8 import requests_pb2, common_pb2, responses_pb2
from phoenixdb.calcite import requests_pb2, common_pb2, responses_pb2
__all__ = ['AvaticaClient']
......@@ -138,33 +136,13 @@ class AvaticaClient(object):
to a server using :func:`phoenixdb.connect`.
"""
def __init__(self, url, version=None, max_retries=None):
def __init__(self, url, max_retries=None):
"""Constructs a new client object.
:param url:
URL of an Avatica RPC server.
:param version:
Version of the Avarica RPC server.
"""
self.url = parse_url(url)
if version is not None:
self.version = version
else:
self.version = AVATICA_1_3_0
query = urlparse.parse_qs(self.url.query)
for v in query.get('v', []):
if v in ('1.2.0', '1.2'):
self.version = AVATICA_1_2_0
elif v in ('1.3.0', '1.3'):
self.version = AVATICA_1_3_0
elif v in ('1.4.0', '1.4'):
self.version = AVATICA_1_4_0
elif v in ('1.5.0', '1.5'):
self.version = AVATICA_1_5_0
elif v in ('1.6.0', '1.6'):
self.version = AVATICA_1_6_0
else:
raise errors.ProgrammingError('Unknown Avatica version')
self.max_retries = max_retries if max_retries is not None else 3
self.connection = None
......
......@@ -20,8 +20,7 @@ from decimal import Decimal
# TODO what are the other types used for, other than tests?
from phoenixdb.types import Binary
from phoenixdb.errors import OperationalError, NotSupportedError, ProgrammingError, InternalError
# TODO conditionally import based on the connection string
from phoenixdb.schema.calcite1_8 import requests_pb2, common_pb2, responses_pb2
from phoenixdb.calcite import common_pb2
__all__ = ['Cursor', 'ColumnDescription']
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment