Skip to content

Commit e0c1d27

Browse files
authored
Merge pull request #11 from rush-db/fix/import_csv_data_argument_type
Fix csv_import data argument type
2 parents fe913f4 + 022d86b commit e0c1d27

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ Imports records from CSV data.
644644
def import_csv(
645645
self,
646646
label: str,
647-
csv_data: Union[str, bytes],
647+
data: str,
648648
options: Optional[Dict[str, bool]] = None,
649649
transaction: Optional[Transaction] = None
650650
) -> List[Dict[str, Any]]
@@ -653,7 +653,7 @@ def import_csv(
653653
**Arguments:**
654654

655655
- `label` (str): Label for imported records
656-
- `csv_data` (Union[str, bytes]): CSV data to import
656+
- `data` (Union[str, bytes]): CSV data to import
657657
- `options` (Optional[Dict[str, bool]]): Import options
658658
- `transaction` (Optional[Transaction]): Optional transaction object
659659

@@ -665,14 +665,14 @@ def import_csv(
665665

666666
```python
667667
# Import records from CSV
668-
csv_data = """name,age,department,role
668+
data = """name,age,department,role
669669
John Doe,30,Engineering,Senior Engineer
670670
Jane Smith,28,Product,Product Manager
671671
Bob Wilson,35,Engineering,Tech Lead"""
672672

673673
records = db.records.import_csv(
674674
label="EMPLOYEE",
675-
csv_data=csv_data,
675+
data=data,
676676
options={"returnResult": True, "suggestTypes": True}
677677
)
678678
```

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "rushdb"
3-
version = "1.5.0"
3+
version = "1.5.1"
44
description = "RushDB Python SDK"
55
authors = ["RushDB Team <hi@rushdb.com>"]
66
license = "Apache-2.0"

src/rushdb/api/records.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def find(
499499
def import_csv(
500500
self,
501501
label: str,
502-
csv_data: Union[str, bytes],
502+
data: str,
503503
options: Optional[Dict[str, bool]] = None,
504504
transaction: Optional[Transaction] = None,
505505
) -> List[Dict[str, Any]]:
@@ -511,8 +511,8 @@ def import_csv(
511511
512512
Args:
513513
label (str): The label/type to assign to all records created from the CSV.
514-
csv_data (Union[str, bytes]): The CSV content to import. Can be provided
515-
as a string or bytes object.
514+
data (Union[str, bytes]): The CSV content to import. Can be provided
515+
as a string.
516516
options (Optional[Dict[str, bool]], optional): Configuration options for the import operation.
517517
Available options:
518518
- returnResult (bool): Whether to return the created records data. Defaults to True.
@@ -541,7 +541,7 @@ def import_csv(
541541

542542
payload = {
543543
"label": label,
544-
"data": csv_data,
544+
"data": data,
545545
"options": options or {"returnResult": True, "suggestTypes": True},
546546
}
547547

tests/test_create_import.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ def test_transaction_rollback(self):
200200

201201
def test_import_csv(self):
202202
"""Test importing data from CSV"""
203-
csv_data = """name,age,department,role,salary
203+
data = """name,age,department,role,salary
204204
John Doe,30,Engineering,Senior Engineer,120000
205205
Jane Smith,28,Product,Product Manager,110000
206206
Bob Wilson,35,Engineering,Tech Lead,140000"""
207207

208-
self.client.records.import_csv("EMPLOYEE", csv_data)
208+
self.client.records.import_csv("EMPLOYEE", data)
209209

210210
def test_search_result_integration(self):
211211
"""Test SearchResult integration with find operations"""

0 commit comments

Comments
 (0)