keboola.component 1.6.8__tar.gz → 1.6.9__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.
Files changed (18) hide show
  1. {keboola.component-1.6.8/src/keboola.component.egg-info → keboola.component-1.6.9}/PKG-INFO +9 -6
  2. {keboola.component-1.6.8 → keboola.component-1.6.9}/README.md +8 -5
  3. {keboola.component-1.6.8 → keboola.component-1.6.9}/setup.py +1 -1
  4. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola/component/dao.py +0 -1
  5. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola/component/interface.py +8 -4
  6. {keboola.component-1.6.8 → keboola.component-1.6.9/src/keboola.component.egg-info}/PKG-INFO +9 -6
  7. {keboola.component-1.6.8 → keboola.component-1.6.9}/LICENSE +0 -0
  8. {keboola.component-1.6.8 → keboola.component-1.6.9}/setup.cfg +0 -0
  9. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola/component/__init__.py +0 -0
  10. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola/component/base.py +0 -0
  11. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola/component/exceptions.py +0 -0
  12. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola/component/sync_actions.py +0 -0
  13. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola/component/table_schema.py +0 -0
  14. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola.component.egg-info/SOURCES.txt +0 -0
  15. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola.component.egg-info/dependency_links.txt +0 -0
  16. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola.component.egg-info/not-zip-safe +0 -0
  17. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola.component.egg-info/requires.txt +0 -0
  18. {keboola.component-1.6.8 → keboola.component-1.6.9}/src/keboola.component.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: keboola.component
3
- Version: 1.6.8
3
+ Version: 1.6.9
4
4
  Summary: General library for Python applications running in Keboola Connection environment
5
5
  Home-page: https://github.com/keboola/python-component
6
6
  Author: Keboola KDS Team
@@ -98,8 +98,11 @@ e.g.
98
98
  - All Environment variables are loaded
99
99
 
100
100
  The optional parameter `data_folder_path` of the constructor is the path to the data directory. If not
101
- provided, [`KBC_DATADIR` environment variable](/extend/common-interface/environment/#environment-variables) will be
102
- used.
101
+ provided it will be determined in this order:
102
+ 1. [`KBC_DATADIR` environment variable](/extend/common-interface/environment/#environment-variables) if present
103
+ 2. -d / --data argument from the command line if present
104
+ 3. data folder inside the current working directory if present
105
+ 4. data folder inside the parent directory of the current working directory if present
103
106
 
104
107
  The class can be either extended or just instantiated and manipulated like object. The `CommonInterface` class is
105
108
  exposed in the `keboola.component` namespace:
@@ -182,7 +185,7 @@ first_table = input_tables[0]
182
185
  logging.info(f'The first table named: "{first_table.name}" is at path: {first_table.full_path}')
183
186
 
184
187
  # get information from table manifest
185
- logging.info(f'The first table has following columns defined in the manifest {first_table.columns}')
188
+ logging.info(f'The first table has following columns defined in the manifest {first_table.column_names}')
186
189
 
187
190
  ```
188
191
 
@@ -242,7 +245,7 @@ ci = CommonInterface(data_folder_path='data')
242
245
 
243
246
  # create container for the result
244
247
  out = ci.create_out_table_definition("testDef",
245
- columns=['foo', 'bar'],
248
+ schema=['foo', 'bar'],
246
249
  destination='some-destination',
247
250
  primary_key=['foo'],
248
251
  incremental=True,
@@ -641,7 +644,7 @@ class Component(ComponentBase):
641
644
  product_schema = self.get_table_schema_by_name('product')
642
645
  product_table = self.create_out_table_definition_from_schema(product_schema)
643
646
  with open(product_table.full_path, 'w') as outfile:
644
- writer = csv.DictWriter(outfile, fieldnames=product_table.columns)
647
+ writer = csv.DictWriter(outfile, fieldnames=product_table.column_names)
645
648
  writer.writerows(DUMMY_PRODUCT_DATA)
646
649
  self.write_manifest(product_table)
647
650
  ```
@@ -79,8 +79,11 @@ e.g.
79
79
  - All Environment variables are loaded
80
80
 
81
81
  The optional parameter `data_folder_path` of the constructor is the path to the data directory. If not
82
- provided, [`KBC_DATADIR` environment variable](/extend/common-interface/environment/#environment-variables) will be
83
- used.
82
+ provided it will be determined in this order:
83
+ 1. [`KBC_DATADIR` environment variable](/extend/common-interface/environment/#environment-variables) if present
84
+ 2. -d / --data argument from the command line if present
85
+ 3. data folder inside the current working directory if present
86
+ 4. data folder inside the parent directory of the current working directory if present
84
87
 
85
88
  The class can be either extended or just instantiated and manipulated like object. The `CommonInterface` class is
86
89
  exposed in the `keboola.component` namespace:
@@ -163,7 +166,7 @@ first_table = input_tables[0]
163
166
  logging.info(f'The first table named: "{first_table.name}" is at path: {first_table.full_path}')
164
167
 
165
168
  # get information from table manifest
166
- logging.info(f'The first table has following columns defined in the manifest {first_table.columns}')
169
+ logging.info(f'The first table has following columns defined in the manifest {first_table.column_names}')
167
170
 
168
171
  ```
169
172
 
@@ -223,7 +226,7 @@ ci = CommonInterface(data_folder_path='data')
223
226
 
224
227
  # create container for the result
225
228
  out = ci.create_out_table_definition("testDef",
226
- columns=['foo', 'bar'],
229
+ schema=['foo', 'bar'],
227
230
  destination='some-destination',
228
231
  primary_key=['foo'],
229
232
  incremental=True,
@@ -622,7 +625,7 @@ class Component(ComponentBase):
622
625
  product_schema = self.get_table_schema_by_name('product')
623
626
  product_table = self.create_out_table_definition_from_schema(product_schema)
624
627
  with open(product_table.full_path, 'w') as outfile:
625
- writer = csv.DictWriter(outfile, fieldnames=product_table.columns)
628
+ writer = csv.DictWriter(outfile, fieldnames=product_table.column_names)
626
629
  writer.writerows(DUMMY_PRODUCT_DATA)
627
630
  self.write_manifest(product_table)
628
631
  ```
@@ -13,7 +13,7 @@ project_urls = {
13
13
 
14
14
  setuptools.setup(
15
15
  name="keboola.component",
16
- version="1.6.8",
16
+ version="1.6.9",
17
17
  author="Keboola KDS Team",
18
18
  project_urls=project_urls,
19
19
  setup_requires=['pytest-runner', 'flake8'],
@@ -505,7 +505,6 @@ class ColumnDefinition:
505
505
  Represents the definition of a column within a table schema.
506
506
 
507
507
  Attributes:
508
- name (Optional[str]): The name of the column. Defaults to None.
509
508
  data_types (Optional[Union[Dict[str, DataType], BaseType]]): Data types of the column for specified backend.
510
509
  This can be a specific `DataType` or a `BaseType`, or a dictionary mapping from a string to one of these types.
511
510
  Defaults to BaseType.String.
@@ -134,10 +134,14 @@ class CommonInterface:
134
134
  args, unknown = argparser.parse_known_args()
135
135
  data_folder_path = args.data_dir
136
136
 
137
- if data_folder_path == '' and self.environment_variables.data_dir:
138
- data_folder_path = self.environment_variables.data_dir
139
- elif data_folder_path == '':
140
- data_folder_path = '/data/'
137
+ if not data_folder_path:
138
+ cwd = Path(os.getcwd())
139
+ if self.environment_variables.data_dir:
140
+ data_folder_path = self.environment_variables.data_dir
141
+ elif cwd.resolve().joinpath('data').is_dir():
142
+ data_folder_path = cwd.resolve().joinpath('data').as_posix()
143
+ elif cwd.resolve().parent.joinpath('data').is_dir():
144
+ data_folder_path = cwd.resolve().parent.joinpath('data').as_posix()
141
145
 
142
146
  return data_folder_path
143
147
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: keboola.component
3
- Version: 1.6.8
3
+ Version: 1.6.9
4
4
  Summary: General library for Python applications running in Keboola Connection environment
5
5
  Home-page: https://github.com/keboola/python-component
6
6
  Author: Keboola KDS Team
@@ -98,8 +98,11 @@ e.g.
98
98
  - All Environment variables are loaded
99
99
 
100
100
  The optional parameter `data_folder_path` of the constructor is the path to the data directory. If not
101
- provided, [`KBC_DATADIR` environment variable](/extend/common-interface/environment/#environment-variables) will be
102
- used.
101
+ provided it will be determined in this order:
102
+ 1. [`KBC_DATADIR` environment variable](/extend/common-interface/environment/#environment-variables) if present
103
+ 2. -d / --data argument from the command line if present
104
+ 3. data folder inside the current working directory if present
105
+ 4. data folder inside the parent directory of the current working directory if present
103
106
 
104
107
  The class can be either extended or just instantiated and manipulated like object. The `CommonInterface` class is
105
108
  exposed in the `keboola.component` namespace:
@@ -182,7 +185,7 @@ first_table = input_tables[0]
182
185
  logging.info(f'The first table named: "{first_table.name}" is at path: {first_table.full_path}')
183
186
 
184
187
  # get information from table manifest
185
- logging.info(f'The first table has following columns defined in the manifest {first_table.columns}')
188
+ logging.info(f'The first table has following columns defined in the manifest {first_table.column_names}')
186
189
 
187
190
  ```
188
191
 
@@ -242,7 +245,7 @@ ci = CommonInterface(data_folder_path='data')
242
245
 
243
246
  # create container for the result
244
247
  out = ci.create_out_table_definition("testDef",
245
- columns=['foo', 'bar'],
248
+ schema=['foo', 'bar'],
246
249
  destination='some-destination',
247
250
  primary_key=['foo'],
248
251
  incremental=True,
@@ -641,7 +644,7 @@ class Component(ComponentBase):
641
644
  product_schema = self.get_table_schema_by_name('product')
642
645
  product_table = self.create_out_table_definition_from_schema(product_schema)
643
646
  with open(product_table.full_path, 'w') as outfile:
644
- writer = csv.DictWriter(outfile, fieldnames=product_table.columns)
647
+ writer = csv.DictWriter(outfile, fieldnames=product_table.column_names)
645
648
  writer.writerows(DUMMY_PRODUCT_DATA)
646
649
  self.write_manifest(product_table)
647
650
  ```