fivetran-cli 0.1.9__tar.gz → 0.1.11__tar.gz

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.

Potentially problematic release.


This version of fivetran-cli might be problematic. Click here for more details.

Files changed (22) hide show
  1. {fivetran_cli-0.1.9/src/fivetran_cli.egg-info → fivetran_cli-0.1.11}/PKG-INFO +31 -9
  2. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/README.md +30 -8
  3. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/pyproject.toml +1 -1
  4. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/src/fivetran_cli/cli.py +89 -16
  5. fivetran_cli-0.1.11/src/fivetran_cli/output.py +575 -0
  6. fivetran_cli-0.1.11/src/fivetran_cli/views.py +123 -0
  7. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11/src/fivetran_cli.egg-info}/PKG-INFO +31 -9
  8. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/src/fivetran_cli.egg-info/SOURCES.txt +1 -0
  9. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/tests/test_cli.py +82 -15
  10. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/tests/test_client.py +3 -0
  11. fivetran_cli-0.1.11/tests/test_output.py +199 -0
  12. fivetran_cli-0.1.9/src/fivetran_cli/output.py +0 -201
  13. fivetran_cli-0.1.9/tests/test_output.py +0 -61
  14. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/LICENSE +0 -0
  15. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/MANIFEST.in +0 -0
  16. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/setup.cfg +0 -0
  17. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/src/fivetran_cli/__init__.py +0 -0
  18. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/src/fivetran_cli/__main__.py +0 -0
  19. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/src/fivetran_cli/client.py +0 -0
  20. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/src/fivetran_cli.egg-info/dependency_links.txt +0 -0
  21. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/src/fivetran_cli.egg-info/requires.txt +0 -0
  22. {fivetran_cli-0.1.9 → fivetran_cli-0.1.11}/src/fivetran_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fivetran-cli
3
- Version: 0.1.9
3
+ Version: 0.1.11
4
4
  Summary: Command line wrapper for the Fivetran REST API and Connector SDK
5
5
  Author: Fivetran
6
6
  License-Expression: MIT
@@ -41,7 +41,7 @@ Credentials default to `FIVETRAN_API_KEY`. Set it to the single Base64-encoded A
41
41
 
42
42
  ```bash
43
43
  fivetran --api-key "$FIVETRAN_API_KEY" connection list
44
- fivetran connection create --data-file connection.json
44
+ fivetran connection create --config-file connection.json
45
45
  fivetran deploy
46
46
  ```
47
47
 
@@ -56,18 +56,38 @@ fivetran connector-metadata get google_ads
56
56
  fivetran public-connector list
57
57
  ```
58
58
 
59
- Output defaults to compact raw JSON for scripting. Use `--pretty` for readable output. Pretty output renders list responses as compact item blocks and detail responses as key/value sections.
59
+ Output defaults to readable text: list responses render as aligned, color-coded
60
+ tables and detail responses as aligned key/value sections. Use `--output json`
61
+ for compact JSON for scripting. Flag and config conventions follow the dbt CLI.
60
62
 
61
63
  ```bash
62
- fivetran connection list --pretty
63
- fivetran connection get connection_id --pretty
64
+ fivetran connection list # default text table
65
+ fivetran connection get connection_id # default text detail
66
+ fivetran connection list --output json # compact JSON
64
67
  ```
65
68
 
66
- Request body commands accept either raw JSON or a JSON file:
69
+ Output options (each with a `FIVETRAN_*` env override where noted):
70
+
71
+ | Flag | Env | Effect |
72
+ |------|-----|--------|
73
+ | `--output {text,json}` | `FIVETRAN_OUTPUT` | Output format (default `text`) |
74
+ | `--output-file PATH` | — | Write rendered output to a file |
75
+ | `--use-colors` / `--no-use-colors` | `FIVETRAN_USE_COLORS` | Toggle ANSI color (default on) |
76
+ | `--printer-width N` | `FIVETRAN_PRINTER_WIDTH` | Wrap/truncation width (default terminal width) |
77
+ | `--wide` | — | Show all non-sensitive fields/columns, no truncation |
78
+ | `--fields a,b,c` | — | Explicit fields/columns to show |
79
+
80
+ Curated resources (connection, destination, group, user, team, webhook,
81
+ transformation) show a focused set of columns by default; everything else is
82
+ shown with `--wide` or `--output json`. Sensitive values (passwords, secrets,
83
+ tokens, API/private keys, and exact `key` fields) are always redacted in text
84
+ output.
85
+
86
+ Create and update commands accept configuration as inline JSON or a JSON file:
67
87
 
68
88
  ```bash
69
- fivetran private-link create --data-file private-link.json
70
- fivetran connection-schema column update connection_id schema table column --data '{"enabled":false}'
89
+ fivetran private-link create --config-file private-link.json
90
+ fivetran connection-schema column update connection_id schema table column --config '{"enabled":false}'
71
91
  ```
72
92
 
73
93
  Destructive commands require `--yes` in non-interactive mode.
@@ -149,4 +169,6 @@ The remaining gaps are intentionally limited to endpoints that need behavior bey
149
169
  - Hub registration
150
170
  - Group destination listing, pending confirmation of a supported REST endpoint
151
171
  - Interactive connector setup workflows
152
- - High-quality resource-specific pretty views beyond the generic renderer
172
+ - Curated table/detail views for the long tail of resources (connection,
173
+ destination, group, user, team, webhook, and transformation are curated today;
174
+ the rest use the generic all-columns-capped fallback)
@@ -24,7 +24,7 @@ Credentials default to `FIVETRAN_API_KEY`. Set it to the single Base64-encoded A
24
24
 
25
25
  ```bash
26
26
  fivetran --api-key "$FIVETRAN_API_KEY" connection list
27
- fivetran connection create --data-file connection.json
27
+ fivetran connection create --config-file connection.json
28
28
  fivetran deploy
29
29
  ```
30
30
 
@@ -39,18 +39,38 @@ fivetran connector-metadata get google_ads
39
39
  fivetran public-connector list
40
40
  ```
41
41
 
42
- Output defaults to compact raw JSON for scripting. Use `--pretty` for readable output. Pretty output renders list responses as compact item blocks and detail responses as key/value sections.
42
+ Output defaults to readable text: list responses render as aligned, color-coded
43
+ tables and detail responses as aligned key/value sections. Use `--output json`
44
+ for compact JSON for scripting. Flag and config conventions follow the dbt CLI.
43
45
 
44
46
  ```bash
45
- fivetran connection list --pretty
46
- fivetran connection get connection_id --pretty
47
+ fivetran connection list # default text table
48
+ fivetran connection get connection_id # default text detail
49
+ fivetran connection list --output json # compact JSON
47
50
  ```
48
51
 
49
- Request body commands accept either raw JSON or a JSON file:
52
+ Output options (each with a `FIVETRAN_*` env override where noted):
53
+
54
+ | Flag | Env | Effect |
55
+ |------|-----|--------|
56
+ | `--output {text,json}` | `FIVETRAN_OUTPUT` | Output format (default `text`) |
57
+ | `--output-file PATH` | — | Write rendered output to a file |
58
+ | `--use-colors` / `--no-use-colors` | `FIVETRAN_USE_COLORS` | Toggle ANSI color (default on) |
59
+ | `--printer-width N` | `FIVETRAN_PRINTER_WIDTH` | Wrap/truncation width (default terminal width) |
60
+ | `--wide` | — | Show all non-sensitive fields/columns, no truncation |
61
+ | `--fields a,b,c` | — | Explicit fields/columns to show |
62
+
63
+ Curated resources (connection, destination, group, user, team, webhook,
64
+ transformation) show a focused set of columns by default; everything else is
65
+ shown with `--wide` or `--output json`. Sensitive values (passwords, secrets,
66
+ tokens, API/private keys, and exact `key` fields) are always redacted in text
67
+ output.
68
+
69
+ Create and update commands accept configuration as inline JSON or a JSON file:
50
70
 
51
71
  ```bash
52
- fivetran private-link create --data-file private-link.json
53
- fivetran connection-schema column update connection_id schema table column --data '{"enabled":false}'
72
+ fivetran private-link create --config-file private-link.json
73
+ fivetran connection-schema column update connection_id schema table column --config '{"enabled":false}'
54
74
  ```
55
75
 
56
76
  Destructive commands require `--yes` in non-interactive mode.
@@ -132,4 +152,6 @@ The remaining gaps are intentionally limited to endpoints that need behavior bey
132
152
  - Hub registration
133
153
  - Group destination listing, pending confirmation of a supported REST endpoint
134
154
  - Interactive connector setup workflows
135
- - High-quality resource-specific pretty views beyond the generic renderer
155
+ - Curated table/detail views for the long tail of resources (connection,
156
+ destination, group, user, team, webhook, and transformation are curated today;
157
+ the rest use the generic all-columns-capped fallback)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fivetran-cli"
7
- version = "0.1.9"
7
+ version = "0.1.11"
8
8
  description = "Command line wrapper for the Fivetran REST API and Connector SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -45,8 +45,17 @@ GLOBAL_OPTIONS_WITH_VALUES = {
45
45
  "--profile",
46
46
  "--base-url",
47
47
  "--output",
48
+ "--output-file",
49
+ "--printer-width",
50
+ "--fields",
51
+ }
52
+ GLOBAL_FLAG_OPTIONS = {
53
+ "--quiet",
54
+ "--verbose",
55
+ "--wide",
56
+ "--use-colors",
57
+ "--no-use-colors",
48
58
  }
49
- GLOBAL_FLAG_OPTIONS = {"--pretty", "--quiet", "--verbose"}
50
59
  OPERATION_EPILOG = (
51
60
  "Credentials default to FIVETRAN_API_KEY, which should contain the Base64-encoded API key. "
52
61
  "FIVETRAN_BASE_URL overrides the default API base URL. "
@@ -121,9 +130,14 @@ def run(
121
130
  emit_output(
122
131
  payload,
123
132
  output_format=output_format,
124
- output_path=args.output,
133
+ output_path=args.output_file,
125
134
  quiet=args.quiet,
126
135
  stdout=stdout,
136
+ view_key=(getattr(args, "resource", None), getattr(args, "operation", None)),
137
+ color=_use_color(args),
138
+ width=_printer_width(args),
139
+ wide=args.wide,
140
+ fields=_fields(args),
127
141
  )
128
142
  return 0
129
143
  except CliError as exc:
@@ -181,8 +195,37 @@ def _add_global_options(parser: argparse.ArgumentParser) -> None:
181
195
  "--base-url",
182
196
  help="Fivetran API base URL. Defaults to FIVETRAN_BASE_URL or https://api.fivetran.com.",
183
197
  )
184
- parser.add_argument("--pretty", action="store_true", help="Render output as a readable summary.")
185
- parser.add_argument("--output", help="Write output to a path instead of stdout.")
198
+ parser.add_argument(
199
+ "--output",
200
+ choices=("text", "json"),
201
+ default=None,
202
+ help="Output format. Defaults to FIVETRAN_OUTPUT or 'text'.",
203
+ )
204
+ parser.add_argument(
205
+ "--output-file",
206
+ help="Write rendered output to a path instead of stdout.",
207
+ )
208
+ parser.add_argument(
209
+ "--use-colors",
210
+ action=argparse.BooleanOptionalAction,
211
+ default=None,
212
+ help="Colorize text output. Defaults to FIVETRAN_USE_COLORS or on.",
213
+ )
214
+ parser.add_argument(
215
+ "--printer-width",
216
+ type=int,
217
+ default=None,
218
+ help="Wrap/truncation width. Defaults to FIVETRAN_PRINTER_WIDTH or terminal width.",
219
+ )
220
+ parser.add_argument(
221
+ "--wide",
222
+ action="store_true",
223
+ help="Show all non-sensitive fields/columns without truncation.",
224
+ )
225
+ parser.add_argument(
226
+ "--fields",
227
+ help="Comma-separated fields/columns to show, overriding the default view.",
228
+ )
186
229
  parser.add_argument("--quiet", action="store_true", help="Suppress response output.")
187
230
  parser.add_argument("--verbose", action="store_true", help="Enable verbose diagnostics.")
188
231
  parser.add_argument(
@@ -193,9 +236,39 @@ def _add_global_options(parser: argparse.ArgumentParser) -> None:
193
236
 
194
237
 
195
238
  def _output_format(args: argparse.Namespace) -> str:
196
- if args.pretty:
197
- return "pretty"
198
- return "json"
239
+ if args.output:
240
+ return args.output
241
+ env = os.environ.get("FIVETRAN_OUTPUT")
242
+ if env in ("text", "json"):
243
+ return env
244
+ return "text"
245
+
246
+
247
+ def _use_color(args: argparse.Namespace) -> bool:
248
+ if args.use_colors is not None:
249
+ return bool(args.use_colors)
250
+ env = os.environ.get("FIVETRAN_USE_COLORS")
251
+ if env is not None:
252
+ return env.strip().lower() in ("1", "true", "yes", "on")
253
+ return True
254
+
255
+
256
+ def _printer_width(args: argparse.Namespace) -> int | None:
257
+ if args.printer_width is not None:
258
+ return args.printer_width
259
+ env = os.environ.get("FIVETRAN_PRINTER_WIDTH")
260
+ if env:
261
+ try:
262
+ return int(env)
263
+ except ValueError:
264
+ pass
265
+ return None
266
+
267
+
268
+ def _fields(args: argparse.Namespace) -> list[str] | None:
269
+ if not args.fields:
270
+ return None
271
+ return [field.strip() for field in args.fields.split(",") if field.strip()]
199
272
 
200
273
 
201
274
  def _add_account(resources: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
@@ -1911,8 +1984,8 @@ def _sdk_command_help() -> tuple[tuple[str, str], ...]:
1911
1984
 
1912
1985
  def _add_body_options(parser: argparse.ArgumentParser, *, required: bool) -> None:
1913
1986
  group = parser.add_mutually_exclusive_group(required=required)
1914
- group.add_argument("--data", help="Raw JSON request body.")
1915
- group.add_argument("--data-file", help="Path to a JSON request body, or '-' for stdin.")
1987
+ group.add_argument("--config", help="Inline JSON configuration.")
1988
+ group.add_argument("--config-file", help="Path to a JSON configuration file, or '-' for stdin.")
1916
1989
 
1917
1990
 
1918
1991
  def _handler(endpoint: Endpoint) -> Handler:
@@ -1956,23 +2029,23 @@ def _format_path(
1956
2029
 
1957
2030
  def _load_body(args: argparse.Namespace) -> Any:
1958
2031
  raw: str | None = None
1959
- if getattr(args, "data", None) is not None:
1960
- raw = args.data
1961
- elif getattr(args, "data_file", None) is not None:
1962
- if args.data_file == "-":
2032
+ if getattr(args, "config", None) is not None:
2033
+ raw = args.config
2034
+ elif getattr(args, "config_file", None) is not None:
2035
+ if args.config_file == "-":
1963
2036
  raw = sys.stdin.read()
1964
2037
  else:
1965
2038
  try:
1966
- raw = Path(args.data_file).read_text(encoding="utf-8")
2039
+ raw = Path(args.config_file).read_text(encoding="utf-8")
1967
2040
  except OSError as exc:
1968
- raise CliError(f"Could not read data file {args.data_file}: {exc}") from exc
2041
+ raise CliError(f"Could not read config file {args.config_file}: {exc}") from exc
1969
2042
 
1970
2043
  if raw is None:
1971
2044
  return None
1972
2045
  try:
1973
2046
  return json.loads(raw)
1974
2047
  except json.JSONDecodeError as exc:
1975
- raise CliError(f"Invalid JSON request body: {exc}") from exc
2048
+ raise CliError(f"Invalid JSON configuration: {exc}") from exc
1976
2049
 
1977
2050
 
1978
2051
  def _confirm_destructive(args: argparse.Namespace) -> None: