Skip to content

Commit

Permalink
isort src/python
Browse files Browse the repository at this point in the history
  • Loading branch information
eunice-chan committed May 3, 2023
1 parent 6174ca5 commit 1ff5a60
Show file tree
Hide file tree
Showing 51 changed files with 100 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import cloudpickle as pickle
from aqueduct.utils.type_inference import infer_artifact_type

from aqueduct_executor.migrators.artifact_migration_000016.spec import MigrationSpec
from aqueduct_executor.operators.utils.enums import ArtifactType, SerializationType
from aqueduct_executor.operators.utils.storage.parse import parse_storage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import json

from aqueduct_executor.operators.utils.storage import config
from pydantic import BaseModel, parse_obj_as

from aqueduct_executor.operators.utils.storage import config


class MigrationSpec(BaseModel):
artifact_type: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

import cloudpickle as pickle
import pandas as pd
from aqueduct_executor.operators.utils.enums import ArtifactType, SerializationType
from PIL import Image

from aqueduct_executor.operators.utils.enums import ArtifactType, SerializationType

_DEFAULT_ENCODING = "utf8"

# The temporary file name that a Tensorflow keras model will be dumped into before we read/write it from storage.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import json

from aqueduct_executor.operators.utils.storage import config
from pydantic import BaseModel, parse_obj_as

from aqueduct_executor.operators.utils.storage import config


class MigrationSpec(BaseModel):
serialization_type: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json

from aqueduct.utils.type_inference import infer_artifact_type

from aqueduct_executor.migrators.parameter_val_type_inference_000019 import serialize
from aqueduct_executor.operators.utils.enums import SerializationType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

import cloudpickle as pickle
import pandas as pd
from aqueduct_executor.operators.utils.enums import ArtifactType, SerializationType
from PIL import Image

from aqueduct_executor.operators.utils.enums import ArtifactType, SerializationType

_DEFAULT_ENCODING = "utf8"
_DEFAULT_IMAGE_FORMAT = "jpeg"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import json

from aqueduct_executor.operators.utils.storage import config
from pydantic import BaseModel, parse_obj_as

from aqueduct_executor.operators.utils.storage import config


class MigrationSpec(BaseModel):
param_val: str
Expand Down
3 changes: 2 additions & 1 deletion src/python/aqueduct_executor/operators/airflow/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import traceback
from typing import Dict, List, Tuple, Union

from jinja2 import Environment, FileSystemLoader

from aqueduct_executor.operators.airflow import spec
from aqueduct_executor.operators.connectors.data import spec as conn_spec
from aqueduct_executor.operators.function_executor import spec as func_spec
Expand All @@ -11,7 +13,6 @@
from aqueduct_executor.operators.utils import utils
from aqueduct_executor.operators.utils.execution import ExecutionState, Logs
from aqueduct_executor.operators.utils.storage import parse
from jinja2 import Environment, FileSystemLoader

TaskSpec = Union[
conn_spec.ExtractSpec,
Expand Down
3 changes: 2 additions & 1 deletion src/python/aqueduct_executor/operators/airflow/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
import uuid
from typing import Dict, List, Literal, Union

from pydantic import BaseModel, parse_obj_as

from aqueduct_executor.operators.connectors.data import spec as conn_spec
from aqueduct_executor.operators.function_executor import spec as func_spec
from aqueduct_executor.operators.param_executor import spec as param_spec
from aqueduct_executor.operators.utils import enums
from aqueduct_executor.operators.utils.storage import config
from pydantic import BaseModel, parse_obj_as

OperatorSpec = Union[
conn_spec.ExtractSpec, conn_spec.LoadSpec, func_spec.FunctionSpec, param_spec.ParamSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import awswrangler as wr
import pandas as pd

from aqueduct_executor.operators.connectors.data import connector, extract, load
from aqueduct_executor.operators.connectors.data.config import AthenaConfig
from aqueduct_executor.operators.connectors.data.utils import construct_boto_session
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
from typing import Any, Dict, List, Optional

import pandas as pd
from google.cloud import bigquery
from google.oauth2 import service_account

from aqueduct_executor.operators.connectors.data import common, config, connector, extract, load
from aqueduct_executor.operators.utils.enums import ArtifactType
from aqueduct_executor.operators.utils.saved_object_delete import SavedObjectDelete
from aqueduct_executor.operators.utils.utils import delete_object
from google.cloud import bigquery
from google.oauth2 import service_account


class BigQueryConnector(connector.DataConnector):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from enum import Enum
from typing import Optional, Union

from pydantic import Field

from aqueduct_executor.operators.connectors.data import models
from aqueduct_executor.operators.utils.enums import MetaEnum
from pydantic import Field

"""Duplicated at `aqueduct/integrations/connect_config.py` for now, please keep them in sync."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from typing import Any, Dict, List, Optional, Union

from aqueduct.resources.parameters import BUILT_IN_EXPANSIONS, TAG_PATTERN
from pydantic import parse_obj_as

from aqueduct_executor.operators.connectors.data import common, models
from aqueduct_executor.operators.utils.enums import ArtifactType
from pydantic import parse_obj_as

# The TAG for 'previous table' when the user specifies a chained query.
PREV_TABLE_TAG = "$"
Expand Down
5 changes: 3 additions & 2 deletions src/python/aqueduct_executor/operators/connectors/data/gcs.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import json
from typing import Any, List

from google.cloud import storage
from google.oauth2 import service_account

from aqueduct_executor.operators.connectors.data import connector
from aqueduct_executor.operators.connectors.data.config import GCSConfig
from aqueduct_executor.operators.utils.enums import ArtifactType
from aqueduct_executor.operators.utils.saved_object_delete import SavedObjectDelete
from google.cloud import storage
from google.oauth2 import service_account

_CREDENTIALS_ENV_VAR = "GCS_CREDENTIALS"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from typing import Optional, Union

from aqueduct_executor.operators.connectors.data import common, models
from pydantic import validator

from aqueduct_executor.operators.connectors.data import common, models


class RelationalParams(models.BaseParams):
table: str
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Optional

from pydantic import BaseModel, Extra


Expand All @@ -18,6 +19,7 @@ class BaseConfig(BaseModel):
BaseConfig defines the Pydantic Config shared by all connector Config's, e.g.
postgres.Config, mysql.Config, etc.
"""

exec_state: Optional[str]

class Config:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from typing import Any, List, Optional

import pandas as pd
from pymongo import MongoClient
from pymongo.client_session import ClientSession
from pymongo.database import Database

from aqueduct_executor.operators.connectors.data import common, connector, extract, load
from aqueduct_executor.operators.connectors.data.config import MongoDBConfig
from aqueduct_executor.operators.utils.enums import ArtifactType
from aqueduct_executor.operators.utils.saved_object_delete import SavedObjectDelete
from aqueduct_executor.operators.utils.utils import delete_object
from pymongo import MongoClient
from pymongo.client_session import ClientSession
from pymongo.database import Database


class MongoDBConnector(connector.DataConnector):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from aqueduct_executor.operators.connectors.data import config, relational, utils
from sqlalchemy import create_engine, engine

from aqueduct_executor.operators.connectors.data import config, relational, utils


class MySqlConnector(relational.RelationalConnector):
def __init__(self, config: config.MySqlConfig):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from aqueduct_executor.operators.connectors.data import config, relational, utils
from sqlalchemy import create_engine, engine

from aqueduct_executor.operators.connectors.data import config, relational, utils


class PostgresConnector(relational.RelationalConnector):
def __init__(self, config: config.PostgresConfig):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from typing import Any, Callable, Dict, List, Optional

import pandas as pd
from aqueduct_executor.operators.connectors.data import connector, extract, load
from aqueduct_executor.operators.utils.enums import ArtifactType
from aqueduct_executor.operators.utils.saved_object_delete import SavedObjectDelete
from aqueduct_executor.operators.utils.utils import delete_object
from sqlalchemy import MetaData, engine, inspect
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.types import VARCHAR

from aqueduct_executor.operators.connectors.data import connector, extract, load
from aqueduct_executor.operators.utils.enums import ArtifactType
from aqueduct_executor.operators.utils.saved_object_delete import SavedObjectDelete
from aqueduct_executor.operators.utils.utils import delete_object


def default_map_object_dtype_to_varchar(df: pd.DataFrame) -> Dict[str, VARCHAR]:
col_to_type = {}
Expand Down
3 changes: 2 additions & 1 deletion src/python/aqueduct_executor/operators/connectors/data/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import numpy as np
import pandas as pd
from aqueduct.utils.serialization import deserialize
from botocore.client import ClientError

from aqueduct_executor.operators.connectors.data import connector, extract, load
from aqueduct_executor.operators.connectors.data.config import S3Config
from aqueduct_executor.operators.connectors.data.s3_serialization import (
Expand All @@ -17,7 +19,6 @@
from aqueduct_executor.operators.utils.enums import ArtifactType
from aqueduct_executor.operators.utils.saved_object_delete import SavedObjectDelete
from aqueduct_executor.operators.utils.utils import delete_object
from botocore.client import ClientError


class S3Connector(connector.DataConnector):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
from aqueduct.constants.enums import S3SerializationType
from aqueduct.utils.serialization import PickleableCollectionSerializationFormat
from aqueduct.utils.type_inference import infer_artifact_type
from PIL import Image

from aqueduct_executor.operators.connectors.data.common import S3TableFormat
from aqueduct_executor.operators.utils.enums import ArtifactType
from PIL import Image

_DEFAULT_JSON_ENCODING = "utf8"
_DEFAULT_IMAGE_FORMAT = "jpeg"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Dict

import pandas as pd
from aqueduct_executor.operators.connectors.data import config, relational, utils
from sqlalchemy import create_engine, engine
from sqlalchemy.types import VARCHAR

from aqueduct_executor.operators.connectors.data import config, relational, utils


class SnowflakeConnector(relational.RelationalConnector):
def __init__(self, config: config.SnowflakeConfig):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
import cloudpickle as pickle
import numpy as np
import pandas as pd
from botocore.client import ClientError
from PIL import Image
from pyspark.sql import DataFrame, SparkSession

from aqueduct_executor.operators.connectors.data import common, connector, extract, load, s3
from aqueduct_executor.operators.connectors.data.config import S3Config
from aqueduct_executor.operators.connectors.data.utils import construct_boto_session
from aqueduct_executor.operators.utils.enums import ArtifactType
from aqueduct_executor.operators.utils.saved_object_delete import SavedObjectDelete
from aqueduct_executor.operators.utils.utils import delete_object
from botocore.client import ClientError
from PIL import Image
from pyspark.sql import DataFrame, SparkSession

_DEFAULT_JSON_ENCODING = "utf8"
_DEFAULT_IMAGE_FORMAT = "jpeg"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from typing import Any

from pyspark.sql import DataFrame, SparkSession
from pyspark.sql.types import FloatType

from aqueduct_executor.operators.connectors.data import (
common,
config,
Expand All @@ -9,8 +12,6 @@
snowflake,
)
from aqueduct_executor.operators.utils.enums import ArtifactType
from pyspark.sql import DataFrame, SparkSession
from pyspark.sql.types import FloatType


class SparkSnowflakeConnector(relational.RelationalConnector):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

import json

from pydantic import parse_obj_as, validator

from aqueduct_executor.operators.connectors.data import common, config, extract, load, models
from aqueduct_executor.operators.utils import enums
from aqueduct_executor.operators.utils.storage import config as sconfig
from pydantic import parse_obj_as, validator

AQUEDUCT_DEMO_NAME = "aqueduct_demo"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pandas as pd
from sqlalchemy import create_engine, engine

from aqueduct_executor.operators.connectors.data import config, load, relational, utils
from aqueduct_executor.operators.utils.enums import ArtifactType
from sqlalchemy import create_engine, engine


class SqlServerConnector(relational.RelationalConnector):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import sqlite3

import pandas as pd
from aqueduct_executor.operators.connectors.data import config, load, relational
from aqueduct_executor.operators.utils.enums import ArtifactType
from packaging.version import parse as parse_version
from sqlalchemy import create_engine, engine

from aqueduct_executor.operators.connectors.data import config, load, relational
from aqueduct_executor.operators.utils.enums import ArtifactType

# https://www.sqlite.org/limits.html#max_variable_number
SQLITE_MAX_VARIABLE_NUMBER = 32766
SQLITE_MAX_VARIABLE_NUMBER_EARLIER_VERSION = 999
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Union

import boto3

from aqueduct_executor.operators.connectors.data.config import (
AthenaConfig,
AWSCredentialType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import pytest
from google.cloud import bigquery

from aqueduct_executor.operators.connectors.data import bigquery as bq
from aqueduct_executor.operators.connectors.data.extract import RelationalParams as ExtractParam
from aqueduct_executor.operators.connectors.data.load import RelationalParams as LoadParam
from aqueduct_executor.operators.connectors.tests import conf, utils
from google.cloud import bigquery

_DATASET = "testdata"
_TABLE = "testdata.bigquery"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from aqueduct_executor.operators.connectors.data import dataframe, maria_db
from aqueduct_executor.operators.connectors.tests import conf, utils

Expand Down
Loading

0 comments on commit 1ff5a60

Please sign in to comment.