* Try running only on modified files * make a change * return something with the wrong type * Revert "return something with the wrong type" This reverts commit23b828371e. * fix typing in file-based * format * Mypy * fix * leave as Mapping * Revert "leave as Mapping" This reverts commit908f063f70. * Use Dict * update * move dict() * Revert "move dict()" This reverts commitfa347a8236. * Revert "Revert "move dict()"" This reverts commitc9237df2e4. * Revert "Revert "Revert "move dict()""" This reverts commit5ac1616414. * use Mapping * point to config file * comment * strict = False * remove -- * Revert "comment" This reverts commit6000814a82. * install types * install types in same command as mypy runs * non-interactive * freeze version * pydantic plugin * plugins * update * ignore missing import * Revert "ignore missing import" This reverts commit1da7930fb7. * Install pydantic instead * fix * this passes locally * strict = true * format * explicitly import models * Update * remove old mypy.ini config * temporarily disable mypy * format * any * format * fix tests * format * Automated Commit - Formatting Changes * Revert "temporarily disable mypy" This reverts commiteb8470fa3f. * implicit reexport * update test * fix mypy * Automated Commit - Formatting Changes * fix some errors in tests * more type fixes * more fixes * more * . * done with tests * fix last files * format * Update gradle * change source-stripe * only run mypy on cdk * remove strict * Add more rules * update * ignore missing imports * cast to string * Allow untyped decorator * reset to master * move to the cdk * derp * move explicit imports around * Automated Commit - Formatting Changes * Revert "move explicit imports around" This reverts commit56e306b72f. * move explicit imports around * Upgrade mypy version * point to config file * Update readme * Ignore errors in the models module * Automated Commit - Formatting Changes * move check to gradle build * Any * try checking out master too * Revert "try checking out master too" This reverts commit8a8f3e373c. * fetch master * install mypy * try without origin * fetch from the script * checkout master * ls the branches * remotes/origin/master * remove some cruft * comment * remove pydantic types * unpin mypy * fetch from the script * Update connectors base too * modify a non-cdk file to confirm it doesn't get checked by mypy * run mypy after generateComponentManifestClassFiles * run from the venv * pass files as arguments * update * fix when running without args * with subdir * path * try without / * ./ * remove filter * try resetting * Revert "try resetting" This reverts commit3a54c424de. * exclude autogen file * do not use the github action * works locally * remove extra fetch * run on connectors base * try bad typing * Revert "try bad typing" This reverts commit33b512a3e4. * reset stripe * Revert "reset stripe" This reverts commit28f23fc6dd. * Revert "Revert "reset stripe"" This reverts commit5bf5dee371. * missing return type * do not ignore the autogen file * remove extra installs * run from venv * Only check files modified on current branch * Revert "Only check files modified on current branch" This reverts commitb4b728e654. * use merge-base * Revert "use merge-base" This reverts commit3136670cbf. * try with updated mypy * bump * run other steps after mypy * reset task ordering * run mypy though * looser config * tests pass * fix mypy issues * type: ignore * optional * this is always a bool * ignore * fix typing issues * remove ignore * remove mapping * Automated Commit - Formatting Changes * Revert "remove ignore" This reverts commit9ffeeb6cb1. * update config --------- Co-authored-by: girarda <girarda@users.noreply.github.com> Co-authored-by: Joe Bell <joseph.bell@airbyte.io>
76 lines
3.7 KiB
Python
76 lines
3.7 KiB
Python
#
|
|
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
|
#
|
|
|
|
from enum import Enum
|
|
|
|
|
|
class FileBasedSourceError(Enum):
|
|
EMPTY_STREAM = "No files were identified in the stream. This may be because there are no files in the specified container, or because your glob patterns did not match any files. Please verify that your source contains files and that your glob patterns are not overly strict."
|
|
EXTENSION_MISMATCH = "The file type that you specified for this stream does not agree with the extension of one or more files in the stream. You may need to modify your glob patterns."
|
|
GLOB_PARSE_ERROR = (
|
|
"Error parsing glob pattern. Please refer to the glob pattern rules at https://facelessuser.github.io/wcmatch/glob/#split."
|
|
)
|
|
ERROR_CASTING_VALUE = "Could not cast the value to the expected type."
|
|
ERROR_CASTING_VALUE_UNRECOGNIZED_TYPE = "Could not cast the value to the expected type because the type is not recognized. Valid types are null, array, boolean, integer, number, object, and string."
|
|
ERROR_DECODING_VALUE = "Expected a JSON-decodeable value but could not decode record."
|
|
ERROR_LISTING_FILES = (
|
|
"Error listing files. Please check the credentials provided in the config and verify that they provide permission to list files."
|
|
)
|
|
ERROR_READING_FILE = (
|
|
"Error opening file. Please check the credentials provided in the config and verify that they provide permission to read files."
|
|
)
|
|
ERROR_PARSING_RECORD = "Error parsing record. This could be due to a mismatch between the config's file type and the actual file type, or because the file or record is not parseable."
|
|
ERROR_PARSING_USER_PROVIDED_SCHEMA = "The provided schema could not be transformed into valid JSON Schema."
|
|
ERROR_VALIDATING_RECORD = "One or more records do not pass the schema validation policy. Please modify your input schema, or select a more lenient validation policy."
|
|
STOP_SYNC_PER_SCHEMA_VALIDATION_POLICY = (
|
|
"Stopping sync in accordance with the configured validation policy. Records in file did not conform to the schema."
|
|
)
|
|
NULL_VALUE_IN_SCHEMA = "Error during schema inference: no type was detected for key."
|
|
UNRECOGNIZED_TYPE = "Error during schema inference: unrecognized type."
|
|
SCHEMA_INFERENCE_ERROR = "Error inferring schema from files. Are the files valid?"
|
|
INVALID_SCHEMA_ERROR = "No fields were identified for this schema. This may happen if the stream is empty. Please check your configuration to verify that there are files that match the stream's glob patterns."
|
|
CONFIG_VALIDATION_ERROR = "Error creating stream config object."
|
|
MISSING_SCHEMA = "Expected `json_schema` in the configured catalog but it is missing."
|
|
UNDEFINED_PARSER = "No parser is defined for this file type."
|
|
UNDEFINED_VALIDATION_POLICY = "The validation policy defined in the config does not exist for the source."
|
|
|
|
|
|
class BaseFileBasedSourceError(Exception):
|
|
def __init__(self, error: FileBasedSourceError, **kwargs): # type: ignore # noqa
|
|
super().__init__(
|
|
f"{FileBasedSourceError(error).value} Contact Support if you need assistance.\n{' '.join([f'{k}={v}' for k, v in kwargs.items()])}"
|
|
)
|
|
|
|
|
|
class ConfigValidationError(BaseFileBasedSourceError):
|
|
pass
|
|
|
|
|
|
class InvalidSchemaError(BaseFileBasedSourceError):
|
|
pass
|
|
|
|
|
|
class MissingSchemaError(BaseFileBasedSourceError):
|
|
pass
|
|
|
|
|
|
class RecordParseError(BaseFileBasedSourceError):
|
|
pass
|
|
|
|
|
|
class SchemaInferenceError(BaseFileBasedSourceError):
|
|
pass
|
|
|
|
|
|
class CheckAvailabilityError(BaseFileBasedSourceError):
|
|
pass
|
|
|
|
|
|
class UndefinedParserError(BaseFileBasedSourceError):
|
|
pass
|
|
|
|
|
|
class StopSyncPerValidationPolicy(BaseFileBasedSourceError):
|
|
pass
|