зеркало из https://github.com/microsoft/cadet-cli.git
Hotfix: Progressbar/Time Remaining More Accurate During Import (#11)
* Swaps in the progress bar update unit to the row and not the document size. Also adds in more references to the delimiter and file endings variables for easier future updating, * Fixes a possible capitalization problem with a linux build. * Adds the flag in `pip install` to not use PEP517 per a discussion on https://github.com/pypa/pip/issues/6163 * Removes the `--no-use-pep517` flag on the Mac build. Prematurely added.
This commit is contained in:
Родитель
49df5e52ed
Коммит
743fd0893c
|
@ -50,7 +50,7 @@ phases:
|
|||
inputs:
|
||||
versionSpec: 3.5
|
||||
- script: |
|
||||
pip3 install -r src/requirements.txt
|
||||
pip3 install --no-use-pep517 -r src/requirements.txt
|
||||
displayName: install requirements
|
||||
- script: |
|
||||
python3 -m pylint src
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
This CLI tool allows a user to upload CSV and TSV files to an Azure CosmosDB instance configured
|
||||
to use DocumentDB.
|
||||
"""
|
||||
|
||||
import csv
|
||||
import os
|
||||
import sys
|
||||
|
@ -15,6 +14,8 @@ DELIMITERS = {
|
|||
'TSV': '\t'
|
||||
}
|
||||
|
||||
FILE_ENDINGS = ('.CSV', '.TSV')
|
||||
|
||||
|
||||
@click.version_option('1.0.0')
|
||||
@click.group()
|
||||
|
@ -68,7 +69,7 @@ def upload(source, type_, collection_name, database_name, primary_key, uri, conn
|
|||
"""
|
||||
# Make sure it's a CSV or TSV
|
||||
type_ = type_.upper()
|
||||
if type_ not in ['CSV', 'TSV'] or not source.upper().endswith(('.CSV', '.TSV')):
|
||||
if type_ not in DELIMITERS or not source.upper().endswith(FILE_ENDINGS):
|
||||
raise click.BadParameter('We currently only support CSV and TSV uploads from Cadet')
|
||||
|
||||
# You must have either the connection string OR (endpoint and key) to connect
|
||||
|
@ -147,10 +148,10 @@ def read_and_upload(source_path, file_type, client, collection_link):
|
|||
document[col] = row[ind]
|
||||
try:
|
||||
client.UpsertItem(collection_link, document)
|
||||
status_bar.update(sys.getsizeof(document))
|
||||
status_bar.update(sys.getsizeof(row))
|
||||
except:
|
||||
raise click.ClickException('Upload failed')
|
||||
click.echo('Upload complete!')
|
||||
click.echo('Upload complete!')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -17,7 +17,7 @@ more-itertools==5.0.0
|
|||
pefile==2018.8.8
|
||||
pluggy==0.8.0
|
||||
py==1.7.0
|
||||
PyInstaller==3.4
|
||||
pyinstaller==3.4
|
||||
pylint==2.2.2
|
||||
pytest==4.0.2
|
||||
pywin32-ctypes==0.2.0
|
||||
|
|
Загрузка…
Ссылка в новой задаче