Skip to content

Commit

Permalink
Refractored code
Browse files Browse the repository at this point in the history
  • Loading branch information
jprakash-db committed Sep 18, 2024
1 parent 8b167b9 commit c42961b
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 15 deletions.
3 changes: 0 additions & 3 deletions databricks_sql_connector_core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ name = "databricks-sql-connector-core"
version = "1.0.0"
description = "Databricks SQL Connector core for Python"
authors = ["Databricks <databricks-sql-connector-maintainers@databricks.com>"]
license = "Apache-2.0"
readme = "README.md"
packages = [{ include = "databricks", from = "src" }]
include = ["CHANGELOG.md"]

[tool.poetry.dependencies]
python = "^3.8.0"
Expand Down
1 change: 0 additions & 1 deletion databricks_sql_connector_core/src/databricks/sql/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Dict, Tuple, List, Optional, Any, Union, Sequence

import pandas
import pyarrow
import requests
import json
import os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from ssl import CERT_NONE, CERT_REQUIRED, create_default_context
from typing import List, Union

import pyarrow
import thrift.transport.THttpClient
import thrift.protocol.TBinaryProtocol
import thrift.transport.TSocket
Expand Down
1 change: 0 additions & 1 deletion databricks_sql_connector_core/src/databricks/sql/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ssl import SSLContext

import lz4.frame
import pyarrow

from databricks.sql import OperationalError, exc
from databricks.sql.cloudfetch.download_manager import ResultFileDownloadManager
Expand Down
File renamed without changes.
10 changes: 9 additions & 1 deletion databricks_sql_connector_core/tests/e2e/common/decimal_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
except ImportError:
pyarrow = None

from tests.e2e.predicate import pysql_supports_arrow
from tests.e2e.common.predicates import pysql_supports_arrow

def decimal_and_expected_results():

if pyarrow is None:
return []

return [
("100.001 AS DECIMAL(6, 3)", Decimal("100.001"), pyarrow.decimal128(6, 3)),
("1000000.0000 AS DECIMAL(11, 4)", Decimal("1000000.0000"), pyarrow.decimal128(11, 4)),
Expand All @@ -23,6 +27,10 @@ def decimal_and_expected_results():
]

def multi_decimals_and_expected_results():

if pyarrow is None:
return []

return [
(
["1 AS DECIMAL(6, 3)", "100.001 AS DECIMAL(6, 3)", "NULL AS DECIMAL(6, 3)"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from numpy import ndarray

from tests.e2e.test_driver import PySQLPytestTestCase
from tests.e2e.predicate import pysql_supports_arrow
from tests.e2e.common.predicates import pysql_supports_arrow

@pytest.mark.skipif(not pysql_supports_arrow(), reason="Skipping because pyarrow is not installed")
class TestComplexTypes(PySQLPytestTestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
VoidParameter,
)
from tests.e2e.test_driver import PySQLPytestTestCase
from tests.e2e.predicate import pysql_supports_arrow
from tests.e2e.common.predicates import pysql_supports_arrow


class ParamStyle(Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
except ImportError:
pa = None

from tests.e2e.predicate import pysql_supports_arrow
from tests.e2e.common.predicates import pysql_supports_arrow

@pytest.mark.skipif(not pysql_supports_arrow(), reason="Skipping because pyarrow is not installed")
class ArrowQueueSuite(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from databricks.sql.thrift_api.TCLIService.ttypes import TSparkArrowResultLink
import databricks.sql.utils as utils
from tests.e2e.predicate import pysql_supports_arrow
from tests.e2e.common.predicates import pysql_supports_arrow

try:
import pyarrow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import databricks.sql.cloudfetch.download_manager as download_manager
from databricks.sql.thrift_api.TCLIService.ttypes import TSparkArrowResultLink

from tests.e2e.predicate import pysql_supports_arrow
from tests.e2e.common.predicates import pysql_supports_arrow

@pytest.mark.skipif(not pysql_supports_arrow(), reason="Skipping because pyarrow is not installed")
class DownloadManagerTests(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion databricks_sql_connector_core/tests/unit/test_fetches.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import databricks.sql.client as client
from databricks.sql.utils import ExecuteResponse, ArrowQueue
from tests.e2e.predicate import pysql_supports_arrow
from tests.e2e.common.predicates import pysql_supports_arrow

try:
import pyarrow as pa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import databricks.sql.client as client
from databricks.sql.utils import ExecuteResponse, ArrowQueue
from tests.e2e.predicate import pysql_supports_arrow
from tests.e2e.common.predicates import pysql_supports_arrow

try:
import pyarrow as pa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from databricks.sql import *
from databricks.sql.auth.authenticators import AuthProvider
from databricks.sql.thrift_backend import ThriftBackend
from tests.e2e.predicate import pysql_supports_arrow
from tests.e2e.common.predicates import pysql_supports_arrow

try:
import pyarrow
Expand Down

0 comments on commit c42961b

Please sign in to comment.