-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source GCS: Migrated to file based CDK (#31212)
Co-authored-by: lazebnyi <[email protected]>
- Loading branch information
Showing
19 changed files
with
704 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
airbyte-integrations/connectors/source-gcs/integration_tests/abnormal_state.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[ | ||
{ | ||
"type": "STREAM", | ||
"stream": { | ||
"stream_state": { | ||
"_ab_source_file_last_modified": "2023-02-27T10:34:32.664000Z_https://storage.googleapis.com/airbyte-integration-test-source-gcs/test_folder/example_1.csv", | ||
"history": { | ||
"https://storage.googleapis.com/airbyte-integration-test-source-gcs/test_folder/example_1.csv": "2023-02-27T10:34:32.664000Z" | ||
} | ||
}, | ||
"stream_descriptor": { | ||
"name": "example_1" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "STREAM", | ||
"stream": { | ||
"stream_state": { | ||
"_ab_source_file_last_modified": "2023-02-27T10:34:32.680000Z_https://storage.googleapis.com/airbyte-integration-test-source-gcs/test_folder/example_2.csv", | ||
"history": { | ||
"https://storage.googleapis.com/airbyte-integration-test-source-gcs/test_folder/example_2.csv": "2023-02-27T10:34:32.680000Z" | ||
} | ||
}, | ||
"stream_descriptor": { | ||
"name": "example_2" | ||
} | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
255 changes: 255 additions & 0 deletions
255
airbyte-integrations/connectors/source-gcs/integration_tests/spec.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
{ | ||
"documentationUrl": "https://docs.airbyte.com/integrations/sources/gcs", | ||
"connectionSpecification": { | ||
"title": "Config", | ||
"description": "NOTE: When this Spec is changed, legacy_config_transformer.py must also be\nmodified to uptake the changes because it is responsible for converting\nlegacy GCS configs into file based configs using the File-Based CDK.", | ||
"type": "object", | ||
"properties": { | ||
"start_date": { | ||
"title": "Start Date", | ||
"description": "UTC date and time in the format 2017-01-25T00:00:00.000000Z. Any file modified before this date will not be replicated.", | ||
"examples": ["2021-01-01T00:00:00.000000Z"], | ||
"format": "date-time", | ||
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6}Z$", | ||
"pattern_descriptor": "YYYY-MM-DDTHH:mm:ss.SSSSSSZ", | ||
"order": 1, | ||
"type": "string" | ||
}, | ||
"streams": { | ||
"title": "The list of streams to sync", | ||
"description": "Each instance of this configuration defines a <a href=https://docs.airbyte.com/cloud/core-concepts#stream>stream</a>. Use this to define which files belong in the stream, their format, and how they should be parsed and validated. When sending data to warehouse destination such as Snowflake or BigQuery, each stream is a separate table.", | ||
"order": 3, | ||
"type": "array", | ||
"items": { | ||
"title": "SourceGCSStreamConfig", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"title": "Name", | ||
"description": "The name of the stream.", | ||
"order": 0, | ||
"type": "string" | ||
}, | ||
"globs": { | ||
"title": "Globs", | ||
"description": "The pattern used to specify which files should be selected from the file system. For more information on glob pattern matching look <a href=\"https://en.wikipedia.org/wiki/Glob_(programming)\">here</a>.", | ||
"order": 1, | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"legacy_prefix": { | ||
"title": "Legacy Prefix", | ||
"description": "The path prefix configured in previous versions of the GCS connector. This option is deprecated in favor of a single glob.", | ||
"airbyte_hidden": true, | ||
"type": "string" | ||
}, | ||
"validation_policy": { | ||
"title": "Validation Policy", | ||
"description": "The name of the validation policy that dictates sync behavior when a record does not adhere to the stream schema.", | ||
"default": "Emit Record", | ||
"enum": ["Emit Record", "Skip Record", "Wait for Discover"] | ||
}, | ||
"input_schema": { | ||
"title": "Input Schema", | ||
"description": "The schema that will be used to validate records extracted from the file. This will override the stream schema that is auto-detected from incoming files.", | ||
"type": "string" | ||
}, | ||
"primary_key": { | ||
"title": "Primary Key", | ||
"description": "The column or columns (for a composite key) that serves as the unique identifier of a record.", | ||
"type": "string" | ||
}, | ||
"days_to_sync_if_history_is_full": { | ||
"title": "Days To Sync If History Is Full", | ||
"description": "When the state history of the file store is full, syncs will only read files that were last modified in the provided day range.", | ||
"default": 3, | ||
"type": "integer" | ||
}, | ||
"format": { | ||
"title": "Format", | ||
"description": "The configuration options that are used to alter how to read incoming files that deviate from the standard formatting.", | ||
"order": 2, | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"title": "CSV Format", | ||
"type": "object", | ||
"properties": { | ||
"filetype": { | ||
"title": "Filetype", | ||
"default": "csv", | ||
"const": "csv", | ||
"type": "string" | ||
}, | ||
"delimiter": { | ||
"title": "Delimiter", | ||
"description": "The character delimiting individual cells in the CSV data. This may only be a 1-character string. For tab-delimited data enter '\\t'.", | ||
"default": ",", | ||
"type": "string" | ||
}, | ||
"quote_char": { | ||
"title": "Quote Character", | ||
"description": "The character used for quoting CSV values. To disallow quoting, make this field blank.", | ||
"default": "\"", | ||
"type": "string" | ||
}, | ||
"escape_char": { | ||
"title": "Escape Character", | ||
"description": "The character used for escaping special characters. To disallow escaping, leave this field blank.", | ||
"type": "string" | ||
}, | ||
"encoding": { | ||
"title": "Encoding", | ||
"description": "The character encoding of the CSV data. Leave blank to default to <strong>UTF8</strong>. See <a href=\"https://docs.python.org/3/library/codecs.html#standard-encodings\" target=\"_blank\">list of python encodings</a> for allowable options.", | ||
"default": "utf8", | ||
"type": "string" | ||
}, | ||
"double_quote": { | ||
"title": "Double Quote", | ||
"description": "Whether two quotes in a quoted CSV value denote a single quote in the data.", | ||
"default": true, | ||
"type": "boolean" | ||
}, | ||
"null_values": { | ||
"title": "Null Values", | ||
"description": "A set of case-sensitive strings that should be interpreted as null values. For example, if the value 'NA' should be interpreted as null, enter 'NA' in this field.", | ||
"default": [], | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"uniqueItems": true | ||
}, | ||
"strings_can_be_null": { | ||
"title": "Strings Can Be Null", | ||
"description": "Whether strings can be interpreted as null values. If true, strings that match the null_values set will be interpreted as null. If false, strings that match the null_values set will be interpreted as the string itself.", | ||
"default": true, | ||
"type": "boolean" | ||
}, | ||
"skip_rows_before_header": { | ||
"title": "Skip Rows Before Header", | ||
"description": "The number of rows to skip before the header row. For example, if the header row is on the 3rd row, enter 2 in this field.", | ||
"default": 0, | ||
"type": "integer" | ||
}, | ||
"skip_rows_after_header": { | ||
"title": "Skip Rows After Header", | ||
"description": "The number of rows to skip after the header row.", | ||
"default": 0, | ||
"type": "integer" | ||
}, | ||
"header_definition": { | ||
"title": "CSV Header Definition", | ||
"description": "How headers will be defined. `User Provided` assumes the CSV does not have a header row and uses the headers provided and `Autogenerated` assumes the CSV does not have a header row and the CDK will generate headers using for `f{i}` where `i` is the index starting from 0. Else, the default behavior is to use the header from the CSV file. If a user wants to autogenerate or provide column names for a CSV having headers, they can skip rows.", | ||
"default": { | ||
"header_definition_type": "From CSV" | ||
}, | ||
"oneOf": [ | ||
{ | ||
"title": "From CSV", | ||
"type": "object", | ||
"properties": { | ||
"header_definition_type": { | ||
"title": "Header Definition Type", | ||
"default": "From CSV", | ||
"const": "From CSV", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
{ | ||
"title": "Autogenerated", | ||
"type": "object", | ||
"properties": { | ||
"header_definition_type": { | ||
"title": "Header Definition Type", | ||
"default": "Autogenerated", | ||
"const": "Autogenerated", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
{ | ||
"title": "User Provided", | ||
"type": "object", | ||
"properties": { | ||
"header_definition_type": { | ||
"title": "Header Definition Type", | ||
"default": "User Provided", | ||
"const": "User Provided", | ||
"type": "string" | ||
}, | ||
"column_names": { | ||
"title": "Column Names", | ||
"description": "The column names that will be used while emitting the CSV records", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": ["column_names"] | ||
} | ||
], | ||
"type": "object" | ||
}, | ||
"true_values": { | ||
"title": "True Values", | ||
"description": "A set of case-sensitive strings that should be interpreted as true values.", | ||
"default": ["y", "yes", "t", "true", "on", "1"], | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"uniqueItems": true | ||
}, | ||
"false_values": { | ||
"title": "False Values", | ||
"description": "A set of case-sensitive strings that should be interpreted as false values.", | ||
"default": ["n", "no", "f", "false", "off", "0"], | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"uniqueItems": true | ||
}, | ||
"inference_type": { | ||
"title": "Inference Type", | ||
"description": "How to infer the types of the columns. If none, inference default to strings.", | ||
"default": "None", | ||
"airbyte_hidden": true, | ||
"enum": ["None", "Primitive Types Only"] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"schemaless": { | ||
"title": "Schemaless", | ||
"description": "When enabled, syncs will not validate or structure records against the stream's schema.", | ||
"default": false, | ||
"type": "boolean" | ||
} | ||
}, | ||
"required": ["name", "format"] | ||
} | ||
}, | ||
"service_account": { | ||
"title": "Service Account Information", | ||
"description": "Enter your Google Cloud <a href=\"https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys\">service account key</a> in JSON format", | ||
"airbyte_secret": true, | ||
"order": 0, | ||
"type": "string" | ||
}, | ||
"bucket": { | ||
"title": "Bucket", | ||
"description": "Name of the GCS bucket where the file(s) exist.", | ||
"order": 2, | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["streams", "service_account", "bucket"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.