diff --git a/README.md b/README.md index d32e277..086f27a 100644 --- a/README.md +++ b/README.md @@ -644,7 +644,7 @@ Imports records from CSV data. def import_csv( self, label: str, - csv_data: Union[str, bytes], + data: str, options: Optional[Dict[str, bool]] = None, transaction: Optional[Transaction] = None ) -> List[Dict[str, Any]] @@ -653,7 +653,7 @@ def import_csv( **Arguments:** - `label` (str): Label for imported records -- `csv_data` (Union[str, bytes]): CSV data to import +- `data` (Union[str, bytes]): CSV data to import - `options` (Optional[Dict[str, bool]]): Import options - `transaction` (Optional[Transaction]): Optional transaction object @@ -665,14 +665,14 @@ def import_csv( ```python # Import records from CSV -csv_data = """name,age,department,role +data = """name,age,department,role John Doe,30,Engineering,Senior Engineer Jane Smith,28,Product,Product Manager Bob Wilson,35,Engineering,Tech Lead""" records = db.records.import_csv( label="EMPLOYEE", - csv_data=csv_data, + data=data, options={"returnResult": True, "suggestTypes": True} ) ``` diff --git a/pyproject.toml b/pyproject.toml index 4a97d1c..3c055a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "rushdb" -version = "1.5.0" +version = "1.5.1" description = "RushDB Python SDK" authors = ["RushDB Team "] license = "Apache-2.0" diff --git a/src/rushdb/api/records.py b/src/rushdb/api/records.py index 1763274..7c311d5 100644 --- a/src/rushdb/api/records.py +++ b/src/rushdb/api/records.py @@ -499,7 +499,7 @@ def find( def import_csv( self, label: str, - csv_data: Union[str, bytes], + data: str, options: Optional[Dict[str, bool]] = None, transaction: Optional[Transaction] = None, ) -> List[Dict[str, Any]]: @@ -511,8 +511,8 @@ def import_csv( Args: label (str): The label/type to assign to all records created from the CSV. - csv_data (Union[str, bytes]): The CSV content to import. Can be provided - as a string or bytes object. + data (Union[str, bytes]): The CSV content to import. Can be provided + as a string. options (Optional[Dict[str, bool]], optional): Configuration options for the import operation. Available options: - returnResult (bool): Whether to return the created records data. Defaults to True. @@ -541,7 +541,7 @@ def import_csv( payload = { "label": label, - "data": csv_data, + "data": data, "options": options or {"returnResult": True, "suggestTypes": True}, } diff --git a/tests/test_create_import.py b/tests/test_create_import.py index 057536f..f08fe7b 100644 --- a/tests/test_create_import.py +++ b/tests/test_create_import.py @@ -200,12 +200,12 @@ def test_transaction_rollback(self): def test_import_csv(self): """Test importing data from CSV""" - csv_data = """name,age,department,role,salary + data = """name,age,department,role,salary John Doe,30,Engineering,Senior Engineer,120000 Jane Smith,28,Product,Product Manager,110000 Bob Wilson,35,Engineering,Tech Lead,140000""" - self.client.records.import_csv("EMPLOYEE", csv_data) + self.client.records.import_csv("EMPLOYEE", data) def test_search_result_integration(self): """Test SearchResult integration with find operations""" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy