airbyte-cdk 6.60.11__py3-none-any.whl → 6.60.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
airbyte_cdk/entrypoint.py CHANGED
@@ -22,7 +22,7 @@ from requests import PreparedRequest, Response, Session
22
22
 
23
23
  from airbyte_cdk.connector import TConfig
24
24
  from airbyte_cdk.exception_handler import init_uncaught_exception_handler
25
- from airbyte_cdk.logger import PRINT_BUFFER, init_logger
25
+ from airbyte_cdk.logger import PRINT_BUFFER, init_logger, is_platform_debug_log_enabled
26
26
  from airbyte_cdk.models import (
27
27
  AirbyteConnectionStatus,
28
28
  AirbyteMessage,
@@ -158,7 +158,7 @@ class AirbyteEntrypoint(object):
158
158
  if not cmd:
159
159
  raise Exception("No command passed")
160
160
 
161
- if hasattr(parsed_args, "debug") and parsed_args.debug:
161
+ if (hasattr(parsed_args, "debug") and parsed_args.debug) or is_platform_debug_log_enabled():
162
162
  self.logger.setLevel(logging.DEBUG)
163
163
  logger.setLevel(logging.DEBUG)
164
164
  self.logger.debug("Debug logs enabled")
airbyte_cdk/logger.py CHANGED
@@ -1,10 +1,10 @@
1
1
  #
2
2
  # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
3
  #
4
-
5
4
  import json
6
5
  import logging
7
6
  import logging.config
7
+ import os
8
8
  from typing import Any, Callable, Mapping, Optional, Tuple
9
9
 
10
10
  import orjson
@@ -40,6 +40,10 @@ LOGGING_CONFIG = {
40
40
  }
41
41
 
42
42
 
43
+ def is_platform_debug_log_enabled() -> bool:
44
+ return os.environ.get("LOG_LEVEL", "info").lower() == "debug"
45
+
46
+
43
47
  def init_logger(name: Optional[str] = None) -> logging.Logger:
44
48
  """Initial set up of logger"""
45
49
  logger = logging.getLogger(name)
@@ -73,8 +77,22 @@ class AirbyteLogFormatter(logging.Formatter):
73
77
  airbyte_level = self.level_mapping.get(record.levelno, "INFO")
74
78
  if airbyte_level == Level.DEBUG:
75
79
  extras = self.extract_extra_args_from_record(record)
76
- debug_dict = {"type": "DEBUG", "message": record.getMessage(), "data": extras}
77
- return filter_secrets(json.dumps(debug_dict))
80
+ if is_platform_debug_log_enabled():
81
+ # We have a different behavior between debug logs enabled through `--debug` argument and debug logs
82
+ # enabled through environment variable. The reason is that for platform logs, we need to have these
83
+ # printed as AirbyteMessage which is not the case with the current previous implementation.
84
+ # Why not migrate both to AirbyteMessages then? AirbyteMessages do not support having structured logs.
85
+ # which means that the DX would be degraded compared to the current solution (devs will need to identify
86
+ # the `log.message` field and figure out where in this field is the response while the current solution
87
+ # have a specific field that is structured for extras.
88
+ message = f"{filter_secrets(record.getMessage())} ///\nExtra logs: {filter_secrets(json.dumps(extras))}"
89
+ log_message = AirbyteMessage(
90
+ type=Type.LOG, log=AirbyteLogMessage(level=airbyte_level, message=message)
91
+ )
92
+ return orjson.dumps(AirbyteMessageSerializer.dump(log_message)).decode()
93
+ else:
94
+ debug_dict = {"type": "DEBUG", "message": record.getMessage(), "data": extras}
95
+ return filter_secrets(json.dumps(debug_dict))
78
96
  else:
79
97
  message = super().format(record)
80
98
  message = filter_secrets(message)
@@ -1838,6 +1838,7 @@ definitions:
1838
1838
  "$ref": "#/definitions/RequestOption"
1839
1839
  page_token_option:
1840
1840
  title: Inject Page Token Into Outgoing HTTP Request
1841
+ description: Inject the page token into the outgoing HTTP requests by inserting it into either the request URL path or a field on the request.
1841
1842
  anyOf:
1842
1843
  - "$ref": "#/definitions/RequestOption"
1843
1844
  - "$ref": "#/definitions/RequestPath"
@@ -3486,7 +3487,7 @@ definitions:
3486
3487
  - [["content", "html"], ["content", "plain_text"]]
3487
3488
  RequestPath:
3488
3489
  title: Request Path
3489
- description: Specifies where in the request path a component's value should be inserted.
3490
+ description: The URL path to be used for the HTTP request.
3490
3491
  type: object
3491
3492
  required:
3492
3493
  - type
@@ -2002,7 +2002,9 @@ class DefaultPaginator(BaseModel):
2002
2002
  None, title="Inject Page Size Into Outgoing HTTP Request"
2003
2003
  )
2004
2004
  page_token_option: Optional[Union[RequestOption, RequestPath]] = Field(
2005
- None, title="Inject Page Token Into Outgoing HTTP Request"
2005
+ None,
2006
+ description="Inject the page token into the outgoing HTTP requests by inserting it into either the request URL path or a field on the request.",
2007
+ title="Inject Page Token Into Outgoing HTTP Request",
2006
2008
  )
2007
2009
  parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
2008
2010
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.60.11
3
+ Version: 6.60.13
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -34,9 +34,9 @@ airbyte_cdk/destinations/vector_db_based/indexer.py,sha256=beiSi2Uu67EoTr7yQSaCJ
34
34
  airbyte_cdk/destinations/vector_db_based/test_utils.py,sha256=MkqLiOJ5QyKbV4rNiJhe-BHM7FD-ADHQ4bQGf4c5lRY,1932
35
35
  airbyte_cdk/destinations/vector_db_based/utils.py,sha256=FOyEo8Lc-fY8UyhpCivhZtIqBRyxf3cUt6anmK03fUY,1127
36
36
  airbyte_cdk/destinations/vector_db_based/writer.py,sha256=nZ00xPiohElJmYktEZZIhr0m5EDETCHGhg0Lb2S7A20,5095
37
- airbyte_cdk/entrypoint.py,sha256=R2kAsAnCAI7eZCctQpMCImLhFFwo7PniJVA0e7RhJVI,19774
37
+ airbyte_cdk/entrypoint.py,sha256=dxPRrHJGQfkLmno-n3AF-J0cHgKDoTtG6PwPMNEFB7o,19842
38
38
  airbyte_cdk/exception_handler.py,sha256=D_doVl3Dt60ASXlJsfviOCswxGyKF2q0RL6rif3fNks,2013
39
- airbyte_cdk/logger.py,sha256=1cURbvawbunCAV178q-XhTHcbAQZTSf07WhU7U9AXWU,3744
39
+ airbyte_cdk/logger.py,sha256=V8E7yO4RerDkyELzFv-NCJx4vEp9dhMkGAbfOnn9Krc,5080
40
40
  airbyte_cdk/manifest_migrations/README.md,sha256=YX1h0xyc4jHdwH3I25ZHqB7R3hcUUCHMvnexpfzF2E8,3020
41
41
  airbyte_cdk/manifest_migrations/__init__.py,sha256=0eq9ic_6GGXMwzE31eAOSA7PLtBauMfgM9XshjYHF84,61
42
42
  airbyte_cdk/manifest_migrations/exceptions.py,sha256=mmMZaCVEkYSGykVL5jKA0xsDWWkybRdQwnh9pGb7VG0,300
@@ -90,7 +90,7 @@ airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=_C0IKcPl
90
90
  airbyte_cdk/sources/declarative/datetime/__init__.py,sha256=4Hw-PX1-VgESLF16cDdvuYCzGJtHntThLF4qIiULWeo,61
91
91
  airbyte_cdk/sources/declarative/datetime/datetime_parser.py,sha256=_zGNGq31RNy_0QBLt_EcTvgPyhj7urPdx6oA3M5-r3o,3150
92
92
  airbyte_cdk/sources/declarative/datetime/min_max_datetime.py,sha256=0BHBtDNQZfvwM45-tY5pNlTcKAFSGGNxemoi0Jic-0E,5785
93
- airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=0LMnv2cp1CzXIKq-ed_GoJWuzeaQMfqVAtREV3FPuRA,186606
93
+ airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=Eh6oMmfFmqNVPZrIG9h5uFKrH3wn0DMjsRRFE47MzT0,186727
94
94
  airbyte_cdk/sources/declarative/declarative_source.py,sha256=qmyMnnet92eGc3C22yBtpvD5UZjqdhsAafP_zxI5wp8,1814
95
95
  airbyte_cdk/sources/declarative/declarative_stream.py,sha256=dCRlddBUSaJmBNBz1pSO1r2rTw8AP5d2_vlmIeGs2gg,10767
96
96
  airbyte_cdk/sources/declarative/decoders/__init__.py,sha256=JHb_0d3SE6kNY10mxA5YBEKPeSbsWYjByq1gUQxepoE,953
@@ -134,7 +134,7 @@ airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migrati
134
134
  airbyte_cdk/sources/declarative/migrations/state_migration.py,sha256=KWPjealMLKSMtajXgkdGgKg7EmTLR-CqqD7UIh0-eDU,794
135
135
  airbyte_cdk/sources/declarative/models/__init__.py,sha256=nUFxNCiKeYRVXuZEKA7GD-lTHxsiKcQ8FitZjKhPIvE,100
136
136
  airbyte_cdk/sources/declarative/models/base_model_with_deprecations.py,sha256=Imnj3yef0aqRdLfaUxkIYISUb8YkiPrRH_wBd-x8HjM,5999
137
- airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=HjCMwAUm_EyRNeafeNMA3Sx1uIOf-RZgtpueY0Li_vE,132129
137
+ airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=51I1NqqIorJwfnEU6M00wZ6PObh8ErVFDV9A_DN0W38,132291
138
138
  airbyte_cdk/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
139
139
  airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py,sha256=nlVvHC511NUyDEEIRBkoeDTAvLqKNp-hRy8D19z8tdk,5941
140
140
  airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=wnRUP0Xeru9Rbu5OexXSDN9QWDo8YU4tT9M2LDVOgGA,802
@@ -424,9 +424,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
424
424
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
425
425
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
426
426
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
427
- airbyte_cdk-6.60.11.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
428
- airbyte_cdk-6.60.11.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
429
- airbyte_cdk-6.60.11.dist-info/METADATA,sha256=ThGpN0itMBbE8stLZwHsuUHiuHa_Zh5eUvybXg-wtTk,6478
430
- airbyte_cdk-6.60.11.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
431
- airbyte_cdk-6.60.11.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
432
- airbyte_cdk-6.60.11.dist-info/RECORD,,
427
+ airbyte_cdk-6.60.13.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
428
+ airbyte_cdk-6.60.13.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
429
+ airbyte_cdk-6.60.13.dist-info/METADATA,sha256=Zy-y3rjiuGIGzc3BLW-7F8zJJAxZMsX85KCPZHIxUXc,6478
430
+ airbyte_cdk-6.60.13.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
431
+ airbyte_cdk-6.60.13.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
432
+ airbyte_cdk-6.60.13.dist-info/RECORD,,