diff options
| author | chertus <[email protected]> | 2022-12-02 13:30:54 +0300 |
|---|---|---|
| committer | chertus <[email protected]> | 2022-12-02 13:30:54 +0300 |
| commit | 80a60e0278e6c06bd0e4afe9fc4a5962831cfe27 (patch) | |
| tree | eacb6cf608b338844842af813f9ba6ddea21ebcc | |
| parent | 495670c2e9d6c343a0be9c99d5d06963fe410633 (diff) | |
try fix csv functional tests
| -rw-r--r-- | ydb/tests/functional/ydb_cli/test_ydb_impex.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/ydb/tests/functional/ydb_cli/test_ydb_impex.py b/ydb/tests/functional/ydb_cli/test_ydb_impex.py index 52927eaf642..586d09d3a2a 100644 --- a/ydb/tests/functional/ydb_cli/test_ydb_impex.py +++ b/ydb/tests/functional/ydb_cli/test_ydb_impex.py @@ -7,13 +7,12 @@ import ydb import logging import pyarrow as pa import pyarrow.parquet as pq -import pandas as pd logger = logging.getLogger(__name__) -DATA_CSV = """key,id,valueo +DATA_CSV = """key,id,value 1,1111,"one" 2,2222,"two" 3,3333,"three" @@ -31,10 +30,9 @@ DATA_JSON = """{"key":1,"id":1111,"value":"one"} {"key":7,"id":7777,"value":"seven"} """ - -DATAFRAME = pd.DataFrame({'key': [1, 2, 3, 5, 7], 'id': [1111, 2222, 3333, 5555, 7777], 'value': ["one", "two", "three", "five", "seven"]}).astype({'key': 'uint32', 'id': 'uint64', 'value': 'string'}) -SCHEMA = pa.schema([('key', pa.uint32()), ('id', pa.uint64()), ('value', pa.string())]) -DATA_PARQUET = pa.Table.from_pandas(DATAFRAME, schema=SCHEMA) +ARRAYS = [pa.array([1, 2, 3, 5, 7], type=pa.uint32()), pa.array([1111, 2222, 3333, 5555, 7777], type=pa.uint64()), pa.array(["one", "two", "three", "five", "seven"], type=pa.string())] +ARRAY_NAMES = ['key', 'id', 'value'] +DATA_PARQUET = pa.Table.from_arrays(ARRAYS, names=ARRAY_NAMES) def ydb_bin(): @@ -110,21 +108,21 @@ class TestImpex(BaseTestTableService): def run_import_csv(self, ftype, data): self.clear_table() - with open("tempinput.dat", "w") as f: + with open("tempinput.csv", "w") as f: f.writelines(data) - self.execute_ydb_cli_command(["import", "file", ftype, "-p", self.table_path, "-i", "tempinput.dat", "--header"]) + self.execute_ydb_cli_command(["import", "file", ftype, "-p", self.table_path, "-i", "tempinput.csv", "--header"]) def run_import_json(self, data): self.clear_table() - with open("tempinput.dat", "w") as f: + with open("tempinput.json", "w") as f: f.writelines(data) - self.execute_ydb_cli_command(["import", "file", "json", "-p", self.table_path, "-i", "tempinput.dat"]) + self.execute_ydb_cli_command(["import", "file", "json", "-p", self.table_path, "-i", "tempinput.json"]) def run_import_parquet(self, data): self.clear_table() - with open("tempinput.dat", "w"): - pq.write_table(data, "tempinput.dat") - output = self.execute_ydb_cli_command(["import", "file", "parquet", "-p", self.table_path, "-i", "tempinput.dat"]) + with open("tempinput.parquet", "w"): + pq.write_table(data, "tempinput.parquet", version="2.4") + output = self.execute_ydb_cli_command(["import", "file", "parquet", "-p", self.table_path, "-i", "tempinput.parquet"]) return self.canonical_result(output) def run_export(self, format): |
