rushdb


Namerushdb JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/rushdb/rushdb-python
SummaryRushDB Python SDK
upload_time2025-02-14 18:33:39
maintainerNone
docs_urlNone
authorRushDB Team
requires_python<4.0,>=3.8
licenseApache-2.0
keywords database graph database instant database instant-database instantdatabase instant db instant-db instantdb neo4j cypher ai ai database etl data-pipeline data science data-science data management data-management machine learning machine-learning persistence db graph graphs graph-database self-hosted rush-db rush db rushdb
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">

![RushDB Logo](https://raw.githubusercontent.com/rush-db/rushdb/main/rushdb-logo.svg)

# RushDB Python SDK
![PyPI - Version](https://img.shields.io/pypi/v/rushdb)

![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rushdb)

![PyPI - License](https://img.shields.io/pypi/l/rushdb)

RushDB is an instant database for modern apps and DS/ML ops built on top of Neo4j.

It automates data normalization, manages relationships, and infers data types, enabling developers to focus on building features rather than wrestling with data.

[🌐 Homepage](https://rushdb.com) — [📢 Blog](https://rushdb.com/blog) — [☁️ Platform ](https://app.rushdb.com) — [📚 Docs](https://docs.rushdb.com/python-sdk/records-api) — [🧑‍💻 Examples](https://github.com/rush-db/examples)
</div>

---

## Installation

Install the RushDB Python SDK via pip:


```sh
pip install rushdb
```

---

## Usage

### **1. Setup SDK**

```python
from rushdb import RushDB

db = RushDB("API_TOKEN", base_url="https://api.rushdb.com")
```

---

### **2. Push any JSON data**


```python
company_data = {
    "name": "Google LLC",
    "address": "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA",
    "foundedAt": "1998-09-04T00:00:00.000Z",
    "rating": 4.9,
    "DEPARTMENT": [{
        "name": "Research & Development",
        "description": "Innovating and creating advanced technologies for AI, cloud computing, and consumer devices.",
        "PROJECT": [{
            "name": "Bard AI",
            "description": "A state-of-the-art generative AI model for natural language understanding and creation.",
            "active": True,
            "budget": 1200000000,
            "EMPLOYEE": [{
                "name": "Jeff Dean",
                "position": "Head of AI Research",
                "email": "jeff@google.com",
                "dob": "1968-07-16T00:00:00.000Z",
                "salary": 3000000
            }]
        }]
    }]
}

db.records.create_many("COMPANY", company_data)
```

This operation will create 4 Records with proper data types and relationships according to this structure:

```cypher
(Record:COMPANY)
  -[r0:RUSHDB_DEFAULT_RELATION]->
    (Record:DEPARTMENT)
      -[r1:RUSHDB_DEFAULT_RELATION]->
        (Record:PROJECT) 
          -[r2:RUSHDB_DEFAULT_RELATION]->
            (Record:EMPLOYEE)
```

---

### **3. Find Records by specific criteria**

```python
query = {
    "labels": ["EMPLOYEE"],
    "where": {
        "position": {"$contains": "AI"},
        "PROJECT": {
            "DEPARTMENT": {
                "COMPANY": {
                    "rating": {"$gte": 4}
                }
            }
        }
    }
}

matched_employees = db.records.find(query)

company = db.records.find_uniq("COMPANY", {"where": {"name": "Google LLC"}})
```

---


# Documentation

# RecordsAPI Documentation

The `RecordsAPI` class provides methods for managing records in RushDB. It handles record creation, updates, deletion, searching, and relationship management.

## Methods

### create()

Creates a new record in RushDB.

**Signature:**
```python
def create(
    self,
    label: str,
    data: Dict[str, Any],
    options: Optional[Dict[str, bool]] = None,
    transaction: Optional[Transaction] = None
) -> Record
```

**Arguments:**
- `label` (str): Label for the record
- `data` (Dict[str, Any]): Record data
- `options` (Optional[Dict[str, bool]]): Optional parsing and response options
  - `returnResult` (bool): Whether to return the created record
  - `suggestTypes` (bool): Whether to suggest property types
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Record`: Created record object

**Example:**
```python
# Create a new company record
data = {
    "name": "Google LLC",
    "address": "1600 Amphitheatre Parkway",
    "foundedAt": "1998-09-04T00:00:00.000Z",
    "rating": 4.9
}

record = db.records.create(
    label="COMPANY",
    data=data,
    options={"returnResult": True, "suggestTypes": True}
)
```

### create_many()

Creates multiple records in a single operation.

**Signature:**
```python
def create_many(
    self,
    label: str,
    data: Union[Dict[str, Any], List[Dict[str, Any]]],
    options: Optional[Dict[str, bool]] = None,
    transaction: Optional[Transaction] = None
) -> List[Record]
```

**Arguments:**
- `label` (str): Label for all records
- `data` (Union[Dict[str, Any], List[Dict[str, Any]]]): List or Dict of record data
- `options` (Optional[Dict[str, bool]]): Optional parsing and response options
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `List[Record]`: List of created record objects

**Example:**
```python
# Create multiple company records
data = [
    {
        "name": "Apple Inc",
        "address": "One Apple Park Way",
        "foundedAt": "1976-04-01T00:00:00.000Z",
        "rating": 4.8
    },
    {
        "name": "Microsoft Corporation",
        "address": "One Microsoft Way",
        "foundedAt": "1975-04-04T00:00:00.000Z",
        "rating": 4.7
    }
]

records = db.records.create_many(
    label="COMPANY",
    data=data,
    options={"returnResult": True, "suggestTypes": True}
)
```

### set()

Updates a record by ID, replacing all data.

**Signature:**
```python
def set(
    self,
    record_id: str,
    data: Dict[str, Any],
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `record_id` (str): ID of the record to update
- `data` (Dict[str, Any]): New record data
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
# Update entire record data
new_data = {
    "name": "Updated Company Name",
    "rating": 5.0
}

response = db.records.set(
    record_id="record-123",
    data=new_data
)
```

### update()

Updates specific fields of a record by ID.

**Signature:**
```python
def update(
    self,
    record_id: str,
    data: Dict[str, Any],
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `record_id` (str): ID of the record to update
- `data` (Dict[str, Any]): Partial record data to update
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
# Update specific fields
updates = {
    "rating": 4.8,
    "status": "active"
}

response = db.records.update(
    record_id="record-123",
    data=updates
)
```

### find()

Searches for records matching specified criteria.

**Signature:**
```python
def find(
    self,
    query: Optional[SearchQuery] = None,
    record_id: Optional[str] = None,
    transaction: Optional[Transaction] = None
) -> List[Record]
```

**Arguments:**
- `query` (Optional[SearchQuery]): Search query parameters
- `record_id` (Optional[str]): Optional record ID to search from
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `List[Record]`: List of matching records

**Example:**
```python
# Search for records with complex criteria
query = {
    "where": {
        "$and": [
            {"age": {"$gte": 18}},
            {"status": "active"},
            {"department": "Engineering"}
        ]
    },
    "orderBy": {"created_at": "desc"},
    "limit": 10
}

records = db.records.find(query=query)
```

### delete()

Deletes records matching a query.

**Signature:**
```python
def delete(
    self,
    query: SearchQuery,
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `query` (SearchQuery): Query to match records for deletion
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
# Delete records matching criteria
query = {
    "where": {
        "status": "inactive",
        "lastActive": {"$lt": "2023-01-01"}
    }
}

response = db.records.delete(query)
```

### delete_by_id()

Deletes one or more records by ID.

**Signature:**
```python
def delete_by_id(
    self,
    id_or_ids: Union[str, List[str]],
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `id_or_ids` (Union[str, List[str]]): Single ID or list of IDs to delete
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
# Delete single record
response = db.records.delete_by_id("record-123")

# Delete multiple records
response = db.records.delete_by_id([
    "record-123",
    "record-456",
    "record-789"
])
```

### attach()

Creates relationships between records.

**Signature:**
```python
def attach(
    self,
    source: Union[str, Dict[str, Any]],
    target: Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]],
    options: Optional[RelationshipOptions] = None,
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `source` (Union[str, Dict[str, Any]]): Source record ID or data
- `target` (Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]]): Target record(s)
- `options` (Optional[RelationshipOptions]): Relationship options
  - `direction` (Optional[Literal["in", "out"]]): Relationship direction
  - `type` (Optional[str]): Relationship type
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
# Create relationship between records
options = RelationshipOptions(
    type="HAS_EMPLOYEE",
    direction="out"
)

response = db.records.attach(
    source="company-123",
    target=["employee-456", "employee-789"],
    options=options
)
```

### detach()

Removes relationships between records.

**Signature:**
```python
def detach(
    self,
    source: Union[str, Dict[str, Any]],
    target: Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]],
    options: Optional[RelationshipDetachOptions] = None,
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `source` (Union[str, Dict[str, Any]]): Source record ID or data
- `target` (Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]]): Target record(s)
- `options` (Optional[RelationshipDetachOptions]): Detach options
  - `direction` (Optional[Literal["in", "out"]]): Relationship direction
  - `typeOrTypes` (Optional[Union[str, List[str]]]): Relationship type(s)
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
# Remove relationships between records
options = RelationshipDetachOptions(
    typeOrTypes=["HAS_EMPLOYEE", "MANAGES"],
    direction="out"
)

response = db.records.detach(
    source="company-123",
    target="employee-456",
    options=options
)
```

### import_csv()

Imports records from CSV data.

**Signature:**
```python
def import_csv(
    self,
    label: str,
    csv_data: Union[str, bytes],
    options: Optional[Dict[str, bool]] = None,
    transaction: Optional[Transaction] = None
) -> List[Dict[str, Any]]
```

**Arguments:**
- `label` (str): Label for imported records
- `csv_data` (Union[str, bytes]): CSV data to import
- `options` (Optional[Dict[str, bool]]): Import options
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `List[Dict[str, Any]]`: Imported records data

**Example:**
```python
# Import records from CSV
csv_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,
    options={"returnResult": True, "suggestTypes": True}
)
```

---

# Record Class Documentation

The `Record` class represents a record in RushDB and provides methods for manipulating individual records, including updates, relationships, and deletions.

## Class Definition

```python
class Record:
    def __init__(self, client: "RushDB", data: Union[Dict[str, Any], None] = None)
```

## Properties

### id

Gets the record's unique identifier.

**Type:** `str`

**Example:**
```python
record = db.records.create("USER", {"name": "John"})
print(record.id)  # e.g., "1234abcd-5678-..."
```

### proptypes

Gets the record's property types.

**Type:** `str`

**Example:**
```python
record = db.records.create("USER", {"name": "John", "age": 25})
print(record.proptypes)  # Returns property type definitions
```

### label

Gets the record's label.

**Type:** `str`

**Example:**
```python
record = db.records.create("USER", {"name": "John"})
print(record.label)  # "USER"
```

### timestamp

Gets the record's creation timestamp from its ID.

**Type:** `int`

**Example:**
```python
record = db.records.create("USER", {"name": "John"})
print(record.timestamp)  # Unix timestamp in milliseconds
```

### date

Gets the record's creation date.

**Type:** `datetime`

**Example:**
```python
record = db.records.create("USER", {"name": "John"})
print(record.date)  # datetime object
```

## Methods

### set()

Updates all data for the record.

**Signature:**
```python
def set(
    self,
    data: Dict[str, Any],
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `data` (Dict[str, Any]): New record data
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
record = db.records.create("USER", {"name": "John"})
response = record.set({
    "name": "John Doe",
    "email": "john@example.com",
    "age": 30
})
```

### update()

Updates specific fields of the record.

**Signature:**
```python
def update(
    self,
    data: Dict[str, Any],
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `data` (Dict[str, Any]): Partial record data to update
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
record = db.records.create("USER", {
    "name": "John",
    "email": "john@example.com"
})
response = record.update({
    "email": "john.doe@example.com"
})
```

### attach()

Creates relationships with other records.

**Signature:**
```python
def attach(
    self,
    target: Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], "Record", List["Record"]],
    options: Optional[RelationshipOptions] = None,
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `target` (Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]]): Target record(s)
- `options` (Optional[RelationshipOptions]): Relationship options
  - `direction` (Optional[Literal["in", "out"]]): Relationship direction
  - `type` (Optional[str]): Relationship type
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
# Create two records
user = db.records.create("USER", {"name": "John"})
group = db.records.create("GROUP", {"name": "Admins"})

# Attach user to group
response = user.attach(
    target=group,
    options=RelationshipOptions(
        type="BELONGS_TO",
        direction="out"
    )
)
```

### detach()

Removes relationships with other records.

**Signature:**
```python
def detach(
    self,
    target: Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], "Record", List["Record"]],
    options: Optional[RelationshipDetachOptions] = None,
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `target` (Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]]): Target record(s)
- `options` (Optional[RelationshipDetachOptions]): Detach options
  - `direction` (Optional[Literal["in", "out"]]): Relationship direction
  - `typeOrTypes` (Optional[Union[str, List[str]]]): Relationship type(s)
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
# Detach user from group
response = user.detach(
    target=group,
    options=RelationshipDetachOptions(
        typeOrTypes="BELONGS_TO",
        direction="out"
    )
)
```

### delete()

Deletes the record.

**Signature:**
```python
def delete(
    self,
    transaction: Optional[Transaction] = None
) -> Dict[str, str]
```

**Arguments:**
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Dict[str, str]`: Response data

**Example:**
```python
user = db.records.create("USER", {"name": "John"})
response = user.delete()
```

## Complete Usage Example

Here's a comprehensive example demonstrating various Record operations:

```python
# Create a new record
user = db.records.create("USER", {
    "name": "John Doe",
    "email": "john@example.com",
    "age": 30
})

# Access properties
print(f"Record ID: {user.id}")
print(f"Label: {user.label}")
print(f"Created at: {user.date}")

# Update record data
user.update({
    "age": 31,
    "title": "Senior Developer"
})

# Create related records
department = db.records.create("DEPARTMENT", {
    "name": "Engineering"
})

project = db.records.create("PROJECT", {
    "name": "Secret Project"
})

# Create relationships
user.attach(
    target=department,
    options=RelationshipOptions(
        type="BELONGS_TO",
        direction="out"
    )
)

user.attach(
    target=project,
    options=RelationshipOptions(
        type="WORKS_ON",
        direction="out"
    )
)

# Remove relationship
user.detach(
    target=project,
    options=RelationshipDetachOptions(
        typeOrTypes="WORKS_ON",
        direction="out"
    )
)

# Delete record
user.delete()
```

## Working with Transactions

Records can be manipulated within transactions for atomic operations:

```python
# Start a transaction
with db.transactions.begin() as transaction:
    # Create user
    user = db.records.create(
        "USER",
        {"name": "John Doe"},
        transaction=transaction
    )
    
    # Update user
    user.update(
        {"status": "active"},
        transaction=transaction
    )
    
    # Create and attach department
    dept = db.records.create(
        "DEPARTMENT",
        {"name": "Engineering"},
        transaction=transaction
    )
    
    user.attach(
        target=dept,
        options=RelationshipOptions(type="BELONGS_TO"),
        transaction=transaction
    )
    
    # Transaction will automatically commit if no errors occur
    # If an error occurs, it will automatically rollback
```

---

# PropertiesAPI Documentation

The `PropertiesAPI` class provides methods for managing and querying properties in RushDB.

## Class Definition

```python
class PropertiesAPI(BaseAPI):
```

## Methods

### find()

Retrieves a list of properties based on optional search criteria.

**Signature:**
```python
def find(
    self,
    query: Optional[SearchQuery] = None,
    transaction: Optional[Transaction] = None
) -> List[Property]
```

**Arguments:**
- `query` (Optional[SearchQuery]): Search query parameters for filtering properties
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `List[Property]`: List of properties matching the search criteria

**Example:**
```python
# Find all properties
properties = client.properties.find()

# Find properties with specific criteria
query = {
    "where": {
        "name": {"$startsWith": "user_"},  # Properties starting with 'user_'
        "type": "string"  # Only string type properties
    },
    "limit": 10  # Limit to 10 results
}
filtered_properties = client.properties.find(query)
```

### find_by_id()

Retrieves a specific property by its ID.

**Signature:**
```python
def find_by_id(
    self,
    property_id: str,
    transaction: Optional[Transaction] = None
) -> Property
```

**Arguments:**
- `property_id` (str): Unique identifier of the property
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `Property`: Property details

**Example:**
```python
# Retrieve a specific property by ID
property_details = client.properties.find_by_id("prop_123456")
```

### delete()

Deletes a property by its ID.

**Signature:**
```python
def delete(
    self,
    property_id: str,
    transaction: Optional[Transaction] = None
) -> None
```

**Arguments:**
- `property_id` (str): Unique identifier of the property to delete
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `None`

**Example:**
```python
# Delete a property
client.properties.delete("prop_123456")
```

### values()

Retrieves values for a specific property with optional sorting and pagination.

**Signature:**
```python
def values(
    self,
    property_id: str,
    sort: Optional[Literal["asc", "desc"]] = None,
    skip: Optional[int] = None,
    limit: Optional[int] = None,
    transaction: Optional[Transaction] = None
) -> PropertyValuesData
```

**Arguments:**
- `property_id` (str): Unique identifier of the property
- `sort` (Optional[Literal["asc", "desc"]]): Sort order of values
- `skip` (Optional[int]): Number of values to skip (for pagination)
- `limit` (Optional[int]): Maximum number of values to return
- `transaction` (Optional[Transaction]): Optional transaction object

**Returns:**
- `PropertyValuesData`: Property values data, including optional min/max and list of values

**Example:**
```python
# Get property values
values_data = client.properties.values(
    property_id="prop_age",
    sort="desc",  # Sort values in descending order
    skip=0,       # Start from the first value
    limit=100     # Return up to 100 values
)

# Access values
print(values_data.get('values', []))  # List of property values
print(values_data.get('min'))         # Minimum value (for numeric properties)
print(values_data.get('max'))         # Maximum value (for numeric properties)
```

## Comprehensive Usage Example

```python
# Find all properties
all_properties = client.properties.find()
for prop in all_properties:
    print(f"Property ID: {prop['id']}")
    print(f"Name: {prop['name']}")
    print(f"Type: {prop['type']}")
    print(f"Metadata: {prop.get('metadata', 'No metadata')}")
    print("---")

# Detailed property search
query = {
    "where": {
        "type": "number",             # Only numeric properties
        "name": {"$contains": "score"}  # Properties with 'score' in name
    },
    "limit": 5  # Limit to 5 results
}
numeric_score_properties = client.properties.find(query)

# Get values for a specific property
if numeric_score_properties:
    first_prop = numeric_score_properties[0]
    prop_values = client.properties.values(
        property_id=first_prop['id'],
        sort="desc",
        limit=50
    )
    print(f"Values for {first_prop['name']}:")
    print(f"Min: {prop_values.get('min')}")
    print(f"Max: {prop_values.get('max')}")
    
    # Detailed property examination
    detailed_prop = client.properties.find_by_id(first_prop['id'])
    print("Detailed Property Info:", detailed_prop)
```

## Property Types and Structures

RushDB supports the following property types:
- `"boolean"`: True/False values
- `"datetime"`: Date and time values
- `"null"`: Null/empty values
- `"number"`: Numeric values
- `"string"`: Text values

### Property Structure Example
```python
property = {
    "id": "prop_unique_id",
    "name": "user_score",
    "type": "number",
    "metadata": Optional[str]  # Optional additional information
}

property_with_value = {
    "id": "prop_unique_id",
    "name": "user_score",
    "type": "number",
    "value": 95.5  # Actual property value
}
```

## Transactions

Properties API methods support optional transactions for atomic operations:

```python
# Using a transaction
with client.transactions.begin() as transaction:
    # Perform multiple property-related operations
    property_to_delete = client.properties.find(
        {"where": {"name": "temp_property"}},
        transaction=transaction
    )[0]
    
    client.properties.delete(
        property_id=property_to_delete['id'],
        transaction=transaction
    )
    # Transaction will automatically commit if no errors occur
```

## Error Handling

When working with the PropertiesAPI, be prepared to handle potential errors:

```python
try:
    # Attempt to find or delete a property
    property_details = client.properties.find_by_id("non_existent_prop")
except RushDBError as e:
    print(f"Error: {e}")
    print(f"Error Details: {e.details}")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rushdb/rushdb-python",
    "name": "rushdb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "database, graph database, instant database, instant-database, instantdatabase, instant db, instant-db, instantdb, neo4j, cypher, ai, ai database, etl, data-pipeline, data science, data-science, data management, data-management, machine learning, machine-learning, persistence, db, graph, graphs, graph-database, self-hosted, rush-db, rush db, rushdb",
    "author": "RushDB Team",
    "author_email": "hi@rushdb.com",
    "download_url": "https://files.pythonhosted.org/packages/89/e9/2aec99d763a2b9bc03766e833088019e229c2ca869ac76cbe35d32f332db/rushdb-0.3.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n\n![RushDB Logo](https://raw.githubusercontent.com/rush-db/rushdb/main/rushdb-logo.svg)\n\n# RushDB Python SDK\n![PyPI - Version](https://img.shields.io/pypi/v/rushdb)\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rushdb)\n\n![PyPI - License](https://img.shields.io/pypi/l/rushdb)\n\nRushDB is an instant database for modern apps and DS/ML ops built on top of Neo4j.\n\nIt automates data normalization, manages relationships, and infers data types, enabling developers to focus on building features rather than wrestling with data.\n\n[\ud83c\udf10 Homepage](https://rushdb.com) \u2014 [\ud83d\udce2 Blog](https://rushdb.com/blog) \u2014 [\u2601\ufe0f Platform ](https://app.rushdb.com) \u2014 [\ud83d\udcda Docs](https://docs.rushdb.com/python-sdk/records-api) \u2014 [\ud83e\uddd1\u200d\ud83d\udcbb Examples](https://github.com/rush-db/examples)\n</div>\n\n---\n\n## Installation\n\nInstall the RushDB Python SDK via pip:\n\n\n```sh\npip install rushdb\n```\n\n---\n\n## Usage\n\n### **1. Setup SDK**\n\n```python\nfrom rushdb import RushDB\n\ndb = RushDB(\"API_TOKEN\", base_url=\"https://api.rushdb.com\")\n```\n\n---\n\n### **2. Push any JSON data**\n\n\n```python\ncompany_data = {\n    \"name\": \"Google LLC\",\n    \"address\": \"1600 Amphitheatre Parkway, Mountain View, CA 94043, USA\",\n    \"foundedAt\": \"1998-09-04T00:00:00.000Z\",\n    \"rating\": 4.9,\n    \"DEPARTMENT\": [{\n        \"name\": \"Research & Development\",\n        \"description\": \"Innovating and creating advanced technologies for AI, cloud computing, and consumer devices.\",\n        \"PROJECT\": [{\n            \"name\": \"Bard AI\",\n            \"description\": \"A state-of-the-art generative AI model for natural language understanding and creation.\",\n            \"active\": True,\n            \"budget\": 1200000000,\n            \"EMPLOYEE\": [{\n                \"name\": \"Jeff Dean\",\n                \"position\": \"Head of AI Research\",\n                \"email\": \"jeff@google.com\",\n                \"dob\": \"1968-07-16T00:00:00.000Z\",\n                \"salary\": 3000000\n            }]\n        }]\n    }]\n}\n\ndb.records.create_many(\"COMPANY\", company_data)\n```\n\nThis operation will create 4 Records with proper data types and relationships according to this structure:\n\n```cypher\n(Record:COMPANY)\n  -[r0:RUSHDB_DEFAULT_RELATION]->\n    (Record:DEPARTMENT)\n      -[r1:RUSHDB_DEFAULT_RELATION]->\n        (Record:PROJECT) \n          -[r2:RUSHDB_DEFAULT_RELATION]->\n            (Record:EMPLOYEE)\n```\n\n---\n\n### **3. Find Records by specific criteria**\n\n```python\nquery = {\n    \"labels\": [\"EMPLOYEE\"],\n    \"where\": {\n        \"position\": {\"$contains\": \"AI\"},\n        \"PROJECT\": {\n            \"DEPARTMENT\": {\n                \"COMPANY\": {\n                    \"rating\": {\"$gte\": 4}\n                }\n            }\n        }\n    }\n}\n\nmatched_employees = db.records.find(query)\n\ncompany = db.records.find_uniq(\"COMPANY\", {\"where\": {\"name\": \"Google LLC\"}})\n```\n\n---\n\n\n# Documentation\n\n# RecordsAPI Documentation\n\nThe `RecordsAPI` class provides methods for managing records in RushDB. It handles record creation, updates, deletion, searching, and relationship management.\n\n## Methods\n\n### create()\n\nCreates a new record in RushDB.\n\n**Signature:**\n```python\ndef create(\n    self,\n    label: str,\n    data: Dict[str, Any],\n    options: Optional[Dict[str, bool]] = None,\n    transaction: Optional[Transaction] = None\n) -> Record\n```\n\n**Arguments:**\n- `label` (str): Label for the record\n- `data` (Dict[str, Any]): Record data\n- `options` (Optional[Dict[str, bool]]): Optional parsing and response options\n  - `returnResult` (bool): Whether to return the created record\n  - `suggestTypes` (bool): Whether to suggest property types\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Record`: Created record object\n\n**Example:**\n```python\n# Create a new company record\ndata = {\n    \"name\": \"Google LLC\",\n    \"address\": \"1600 Amphitheatre Parkway\",\n    \"foundedAt\": \"1998-09-04T00:00:00.000Z\",\n    \"rating\": 4.9\n}\n\nrecord = db.records.create(\n    label=\"COMPANY\",\n    data=data,\n    options={\"returnResult\": True, \"suggestTypes\": True}\n)\n```\n\n### create_many()\n\nCreates multiple records in a single operation.\n\n**Signature:**\n```python\ndef create_many(\n    self,\n    label: str,\n    data: Union[Dict[str, Any], List[Dict[str, Any]]],\n    options: Optional[Dict[str, bool]] = None,\n    transaction: Optional[Transaction] = None\n) -> List[Record]\n```\n\n**Arguments:**\n- `label` (str): Label for all records\n- `data` (Union[Dict[str, Any], List[Dict[str, Any]]]): List or Dict of record data\n- `options` (Optional[Dict[str, bool]]): Optional parsing and response options\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `List[Record]`: List of created record objects\n\n**Example:**\n```python\n# Create multiple company records\ndata = [\n    {\n        \"name\": \"Apple Inc\",\n        \"address\": \"One Apple Park Way\",\n        \"foundedAt\": \"1976-04-01T00:00:00.000Z\",\n        \"rating\": 4.8\n    },\n    {\n        \"name\": \"Microsoft Corporation\",\n        \"address\": \"One Microsoft Way\",\n        \"foundedAt\": \"1975-04-04T00:00:00.000Z\",\n        \"rating\": 4.7\n    }\n]\n\nrecords = db.records.create_many(\n    label=\"COMPANY\",\n    data=data,\n    options={\"returnResult\": True, \"suggestTypes\": True}\n)\n```\n\n### set()\n\nUpdates a record by ID, replacing all data.\n\n**Signature:**\n```python\ndef set(\n    self,\n    record_id: str,\n    data: Dict[str, Any],\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `record_id` (str): ID of the record to update\n- `data` (Dict[str, Any]): New record data\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\n# Update entire record data\nnew_data = {\n    \"name\": \"Updated Company Name\",\n    \"rating\": 5.0\n}\n\nresponse = db.records.set(\n    record_id=\"record-123\",\n    data=new_data\n)\n```\n\n### update()\n\nUpdates specific fields of a record by ID.\n\n**Signature:**\n```python\ndef update(\n    self,\n    record_id: str,\n    data: Dict[str, Any],\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `record_id` (str): ID of the record to update\n- `data` (Dict[str, Any]): Partial record data to update\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\n# Update specific fields\nupdates = {\n    \"rating\": 4.8,\n    \"status\": \"active\"\n}\n\nresponse = db.records.update(\n    record_id=\"record-123\",\n    data=updates\n)\n```\n\n### find()\n\nSearches for records matching specified criteria.\n\n**Signature:**\n```python\ndef find(\n    self,\n    query: Optional[SearchQuery] = None,\n    record_id: Optional[str] = None,\n    transaction: Optional[Transaction] = None\n) -> List[Record]\n```\n\n**Arguments:**\n- `query` (Optional[SearchQuery]): Search query parameters\n- `record_id` (Optional[str]): Optional record ID to search from\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `List[Record]`: List of matching records\n\n**Example:**\n```python\n# Search for records with complex criteria\nquery = {\n    \"where\": {\n        \"$and\": [\n            {\"age\": {\"$gte\": 18}},\n            {\"status\": \"active\"},\n            {\"department\": \"Engineering\"}\n        ]\n    },\n    \"orderBy\": {\"created_at\": \"desc\"},\n    \"limit\": 10\n}\n\nrecords = db.records.find(query=query)\n```\n\n### delete()\n\nDeletes records matching a query.\n\n**Signature:**\n```python\ndef delete(\n    self,\n    query: SearchQuery,\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `query` (SearchQuery): Query to match records for deletion\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\n# Delete records matching criteria\nquery = {\n    \"where\": {\n        \"status\": \"inactive\",\n        \"lastActive\": {\"$lt\": \"2023-01-01\"}\n    }\n}\n\nresponse = db.records.delete(query)\n```\n\n### delete_by_id()\n\nDeletes one or more records by ID.\n\n**Signature:**\n```python\ndef delete_by_id(\n    self,\n    id_or_ids: Union[str, List[str]],\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `id_or_ids` (Union[str, List[str]]): Single ID or list of IDs to delete\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\n# Delete single record\nresponse = db.records.delete_by_id(\"record-123\")\n\n# Delete multiple records\nresponse = db.records.delete_by_id([\n    \"record-123\",\n    \"record-456\",\n    \"record-789\"\n])\n```\n\n### attach()\n\nCreates relationships between records.\n\n**Signature:**\n```python\ndef attach(\n    self,\n    source: Union[str, Dict[str, Any]],\n    target: Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]],\n    options: Optional[RelationshipOptions] = None,\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `source` (Union[str, Dict[str, Any]]): Source record ID or data\n- `target` (Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]]): Target record(s)\n- `options` (Optional[RelationshipOptions]): Relationship options\n  - `direction` (Optional[Literal[\"in\", \"out\"]]): Relationship direction\n  - `type` (Optional[str]): Relationship type\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\n# Create relationship between records\noptions = RelationshipOptions(\n    type=\"HAS_EMPLOYEE\",\n    direction=\"out\"\n)\n\nresponse = db.records.attach(\n    source=\"company-123\",\n    target=[\"employee-456\", \"employee-789\"],\n    options=options\n)\n```\n\n### detach()\n\nRemoves relationships between records.\n\n**Signature:**\n```python\ndef detach(\n    self,\n    source: Union[str, Dict[str, Any]],\n    target: Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]],\n    options: Optional[RelationshipDetachOptions] = None,\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `source` (Union[str, Dict[str, Any]]): Source record ID or data\n- `target` (Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]]): Target record(s)\n- `options` (Optional[RelationshipDetachOptions]): Detach options\n  - `direction` (Optional[Literal[\"in\", \"out\"]]): Relationship direction\n  - `typeOrTypes` (Optional[Union[str, List[str]]]): Relationship type(s)\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\n# Remove relationships between records\noptions = RelationshipDetachOptions(\n    typeOrTypes=[\"HAS_EMPLOYEE\", \"MANAGES\"],\n    direction=\"out\"\n)\n\nresponse = db.records.detach(\n    source=\"company-123\",\n    target=\"employee-456\",\n    options=options\n)\n```\n\n### import_csv()\n\nImports records from CSV data.\n\n**Signature:**\n```python\ndef import_csv(\n    self,\n    label: str,\n    csv_data: Union[str, bytes],\n    options: Optional[Dict[str, bool]] = None,\n    transaction: Optional[Transaction] = None\n) -> List[Dict[str, Any]]\n```\n\n**Arguments:**\n- `label` (str): Label for imported records\n- `csv_data` (Union[str, bytes]): CSV data to import\n- `options` (Optional[Dict[str, bool]]): Import options\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `List[Dict[str, Any]]`: Imported records data\n\n**Example:**\n```python\n# Import records from CSV\ncsv_data = \"\"\"name,age,department,role\nJohn Doe,30,Engineering,Senior Engineer\nJane Smith,28,Product,Product Manager\nBob Wilson,35,Engineering,Tech Lead\"\"\"\n\nrecords = db.records.import_csv(\n    label=\"EMPLOYEE\",\n    csv_data=csv_data,\n    options={\"returnResult\": True, \"suggestTypes\": True}\n)\n```\n\n---\n\n# Record Class Documentation\n\nThe `Record` class represents a record in RushDB and provides methods for manipulating individual records, including updates, relationships, and deletions.\n\n## Class Definition\n\n```python\nclass Record:\n    def __init__(self, client: \"RushDB\", data: Union[Dict[str, Any], None] = None)\n```\n\n## Properties\n\n### id\n\nGets the record's unique identifier.\n\n**Type:** `str`\n\n**Example:**\n```python\nrecord = db.records.create(\"USER\", {\"name\": \"John\"})\nprint(record.id)  # e.g., \"1234abcd-5678-...\"\n```\n\n### proptypes\n\nGets the record's property types.\n\n**Type:** `str`\n\n**Example:**\n```python\nrecord = db.records.create(\"USER\", {\"name\": \"John\", \"age\": 25})\nprint(record.proptypes)  # Returns property type definitions\n```\n\n### label\n\nGets the record's label.\n\n**Type:** `str`\n\n**Example:**\n```python\nrecord = db.records.create(\"USER\", {\"name\": \"John\"})\nprint(record.label)  # \"USER\"\n```\n\n### timestamp\n\nGets the record's creation timestamp from its ID.\n\n**Type:** `int`\n\n**Example:**\n```python\nrecord = db.records.create(\"USER\", {\"name\": \"John\"})\nprint(record.timestamp)  # Unix timestamp in milliseconds\n```\n\n### date\n\nGets the record's creation date.\n\n**Type:** `datetime`\n\n**Example:**\n```python\nrecord = db.records.create(\"USER\", {\"name\": \"John\"})\nprint(record.date)  # datetime object\n```\n\n## Methods\n\n### set()\n\nUpdates all data for the record.\n\n**Signature:**\n```python\ndef set(\n    self,\n    data: Dict[str, Any],\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `data` (Dict[str, Any]): New record data\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\nrecord = db.records.create(\"USER\", {\"name\": \"John\"})\nresponse = record.set({\n    \"name\": \"John Doe\",\n    \"email\": \"john@example.com\",\n    \"age\": 30\n})\n```\n\n### update()\n\nUpdates specific fields of the record.\n\n**Signature:**\n```python\ndef update(\n    self,\n    data: Dict[str, Any],\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `data` (Dict[str, Any]): Partial record data to update\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\nrecord = db.records.create(\"USER\", {\n    \"name\": \"John\",\n    \"email\": \"john@example.com\"\n})\nresponse = record.update({\n    \"email\": \"john.doe@example.com\"\n})\n```\n\n### attach()\n\nCreates relationships with other records.\n\n**Signature:**\n```python\ndef attach(\n    self,\n    target: Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], \"Record\", List[\"Record\"]],\n    options: Optional[RelationshipOptions] = None,\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `target` (Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]]): Target record(s)\n- `options` (Optional[RelationshipOptions]): Relationship options\n  - `direction` (Optional[Literal[\"in\", \"out\"]]): Relationship direction\n  - `type` (Optional[str]): Relationship type\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\n# Create two records\nuser = db.records.create(\"USER\", {\"name\": \"John\"})\ngroup = db.records.create(\"GROUP\", {\"name\": \"Admins\"})\n\n# Attach user to group\nresponse = user.attach(\n    target=group,\n    options=RelationshipOptions(\n        type=\"BELONGS_TO\",\n        direction=\"out\"\n    )\n)\n```\n\n### detach()\n\nRemoves relationships with other records.\n\n**Signature:**\n```python\ndef detach(\n    self,\n    target: Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], \"Record\", List[\"Record\"]],\n    options: Optional[RelationshipDetachOptions] = None,\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `target` (Union[str, List[str], Dict[str, Any], List[Dict[str, Any]], Record, List[Record]]): Target record(s)\n- `options` (Optional[RelationshipDetachOptions]): Detach options\n  - `direction` (Optional[Literal[\"in\", \"out\"]]): Relationship direction\n  - `typeOrTypes` (Optional[Union[str, List[str]]]): Relationship type(s)\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\n# Detach user from group\nresponse = user.detach(\n    target=group,\n    options=RelationshipDetachOptions(\n        typeOrTypes=\"BELONGS_TO\",\n        direction=\"out\"\n    )\n)\n```\n\n### delete()\n\nDeletes the record.\n\n**Signature:**\n```python\ndef delete(\n    self,\n    transaction: Optional[Transaction] = None\n) -> Dict[str, str]\n```\n\n**Arguments:**\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Dict[str, str]`: Response data\n\n**Example:**\n```python\nuser = db.records.create(\"USER\", {\"name\": \"John\"})\nresponse = user.delete()\n```\n\n## Complete Usage Example\n\nHere's a comprehensive example demonstrating various Record operations:\n\n```python\n# Create a new record\nuser = db.records.create(\"USER\", {\n    \"name\": \"John Doe\",\n    \"email\": \"john@example.com\",\n    \"age\": 30\n})\n\n# Access properties\nprint(f\"Record ID: {user.id}\")\nprint(f\"Label: {user.label}\")\nprint(f\"Created at: {user.date}\")\n\n# Update record data\nuser.update({\n    \"age\": 31,\n    \"title\": \"Senior Developer\"\n})\n\n# Create related records\ndepartment = db.records.create(\"DEPARTMENT\", {\n    \"name\": \"Engineering\"\n})\n\nproject = db.records.create(\"PROJECT\", {\n    \"name\": \"Secret Project\"\n})\n\n# Create relationships\nuser.attach(\n    target=department,\n    options=RelationshipOptions(\n        type=\"BELONGS_TO\",\n        direction=\"out\"\n    )\n)\n\nuser.attach(\n    target=project,\n    options=RelationshipOptions(\n        type=\"WORKS_ON\",\n        direction=\"out\"\n    )\n)\n\n# Remove relationship\nuser.detach(\n    target=project,\n    options=RelationshipDetachOptions(\n        typeOrTypes=\"WORKS_ON\",\n        direction=\"out\"\n    )\n)\n\n# Delete record\nuser.delete()\n```\n\n## Working with Transactions\n\nRecords can be manipulated within transactions for atomic operations:\n\n```python\n# Start a transaction\nwith db.transactions.begin() as transaction:\n    # Create user\n    user = db.records.create(\n        \"USER\",\n        {\"name\": \"John Doe\"},\n        transaction=transaction\n    )\n    \n    # Update user\n    user.update(\n        {\"status\": \"active\"},\n        transaction=transaction\n    )\n    \n    # Create and attach department\n    dept = db.records.create(\n        \"DEPARTMENT\",\n        {\"name\": \"Engineering\"},\n        transaction=transaction\n    )\n    \n    user.attach(\n        target=dept,\n        options=RelationshipOptions(type=\"BELONGS_TO\"),\n        transaction=transaction\n    )\n    \n    # Transaction will automatically commit if no errors occur\n    # If an error occurs, it will automatically rollback\n```\n\n---\n\n# PropertiesAPI Documentation\n\nThe `PropertiesAPI` class provides methods for managing and querying properties in RushDB.\n\n## Class Definition\n\n```python\nclass PropertiesAPI(BaseAPI):\n```\n\n## Methods\n\n### find()\n\nRetrieves a list of properties based on optional search criteria.\n\n**Signature:**\n```python\ndef find(\n    self,\n    query: Optional[SearchQuery] = None,\n    transaction: Optional[Transaction] = None\n) -> List[Property]\n```\n\n**Arguments:**\n- `query` (Optional[SearchQuery]): Search query parameters for filtering properties\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `List[Property]`: List of properties matching the search criteria\n\n**Example:**\n```python\n# Find all properties\nproperties = client.properties.find()\n\n# Find properties with specific criteria\nquery = {\n    \"where\": {\n        \"name\": {\"$startsWith\": \"user_\"},  # Properties starting with 'user_'\n        \"type\": \"string\"  # Only string type properties\n    },\n    \"limit\": 10  # Limit to 10 results\n}\nfiltered_properties = client.properties.find(query)\n```\n\n### find_by_id()\n\nRetrieves a specific property by its ID.\n\n**Signature:**\n```python\ndef find_by_id(\n    self,\n    property_id: str,\n    transaction: Optional[Transaction] = None\n) -> Property\n```\n\n**Arguments:**\n- `property_id` (str): Unique identifier of the property\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `Property`: Property details\n\n**Example:**\n```python\n# Retrieve a specific property by ID\nproperty_details = client.properties.find_by_id(\"prop_123456\")\n```\n\n### delete()\n\nDeletes a property by its ID.\n\n**Signature:**\n```python\ndef delete(\n    self,\n    property_id: str,\n    transaction: Optional[Transaction] = None\n) -> None\n```\n\n**Arguments:**\n- `property_id` (str): Unique identifier of the property to delete\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `None`\n\n**Example:**\n```python\n# Delete a property\nclient.properties.delete(\"prop_123456\")\n```\n\n### values()\n\nRetrieves values for a specific property with optional sorting and pagination.\n\n**Signature:**\n```python\ndef values(\n    self,\n    property_id: str,\n    sort: Optional[Literal[\"asc\", \"desc\"]] = None,\n    skip: Optional[int] = None,\n    limit: Optional[int] = None,\n    transaction: Optional[Transaction] = None\n) -> PropertyValuesData\n```\n\n**Arguments:**\n- `property_id` (str): Unique identifier of the property\n- `sort` (Optional[Literal[\"asc\", \"desc\"]]): Sort order of values\n- `skip` (Optional[int]): Number of values to skip (for pagination)\n- `limit` (Optional[int]): Maximum number of values to return\n- `transaction` (Optional[Transaction]): Optional transaction object\n\n**Returns:**\n- `PropertyValuesData`: Property values data, including optional min/max and list of values\n\n**Example:**\n```python\n# Get property values\nvalues_data = client.properties.values(\n    property_id=\"prop_age\",\n    sort=\"desc\",  # Sort values in descending order\n    skip=0,       # Start from the first value\n    limit=100     # Return up to 100 values\n)\n\n# Access values\nprint(values_data.get('values', []))  # List of property values\nprint(values_data.get('min'))         # Minimum value (for numeric properties)\nprint(values_data.get('max'))         # Maximum value (for numeric properties)\n```\n\n## Comprehensive Usage Example\n\n```python\n# Find all properties\nall_properties = client.properties.find()\nfor prop in all_properties:\n    print(f\"Property ID: {prop['id']}\")\n    print(f\"Name: {prop['name']}\")\n    print(f\"Type: {prop['type']}\")\n    print(f\"Metadata: {prop.get('metadata', 'No metadata')}\")\n    print(\"---\")\n\n# Detailed property search\nquery = {\n    \"where\": {\n        \"type\": \"number\",             # Only numeric properties\n        \"name\": {\"$contains\": \"score\"}  # Properties with 'score' in name\n    },\n    \"limit\": 5  # Limit to 5 results\n}\nnumeric_score_properties = client.properties.find(query)\n\n# Get values for a specific property\nif numeric_score_properties:\n    first_prop = numeric_score_properties[0]\n    prop_values = client.properties.values(\n        property_id=first_prop['id'],\n        sort=\"desc\",\n        limit=50\n    )\n    print(f\"Values for {first_prop['name']}:\")\n    print(f\"Min: {prop_values.get('min')}\")\n    print(f\"Max: {prop_values.get('max')}\")\n    \n    # Detailed property examination\n    detailed_prop = client.properties.find_by_id(first_prop['id'])\n    print(\"Detailed Property Info:\", detailed_prop)\n```\n\n## Property Types and Structures\n\nRushDB supports the following property types:\n- `\"boolean\"`: True/False values\n- `\"datetime\"`: Date and time values\n- `\"null\"`: Null/empty values\n- `\"number\"`: Numeric values\n- `\"string\"`: Text values\n\n### Property Structure Example\n```python\nproperty = {\n    \"id\": \"prop_unique_id\",\n    \"name\": \"user_score\",\n    \"type\": \"number\",\n    \"metadata\": Optional[str]  # Optional additional information\n}\n\nproperty_with_value = {\n    \"id\": \"prop_unique_id\",\n    \"name\": \"user_score\",\n    \"type\": \"number\",\n    \"value\": 95.5  # Actual property value\n}\n```\n\n## Transactions\n\nProperties API methods support optional transactions for atomic operations:\n\n```python\n# Using a transaction\nwith client.transactions.begin() as transaction:\n    # Perform multiple property-related operations\n    property_to_delete = client.properties.find(\n        {\"where\": {\"name\": \"temp_property\"}},\n        transaction=transaction\n    )[0]\n    \n    client.properties.delete(\n        property_id=property_to_delete['id'],\n        transaction=transaction\n    )\n    # Transaction will automatically commit if no errors occur\n```\n\n## Error Handling\n\nWhen working with the PropertiesAPI, be prepared to handle potential errors:\n\n```python\ntry:\n    # Attempt to find or delete a property\n    property_details = client.properties.find_by_id(\"non_existent_prop\")\nexcept RushDBError as e:\n    print(f\"Error: {e}\")\n    print(f\"Error Details: {e.details}\")\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "RushDB Python SDK",
    "version": "0.3.0",
    "project_urls": {
        "Documentation": "https://docs.rushdb.com",
        "Homepage": "https://github.com/rushdb/rushdb-python",
        "Repository": "https://github.com/rushdb/rushdb-python"
    },
    "split_keywords": [
        "database",
        " graph database",
        " instant database",
        " instant-database",
        " instantdatabase",
        " instant db",
        " instant-db",
        " instantdb",
        " neo4j",
        " cypher",
        " ai",
        " ai database",
        " etl",
        " data-pipeline",
        " data science",
        " data-science",
        " data management",
        " data-management",
        " machine learning",
        " machine-learning",
        " persistence",
        " db",
        " graph",
        " graphs",
        " graph-database",
        " self-hosted",
        " rush-db",
        " rush db",
        " rushdb"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "318cdf2fa5e66baf270b6b58f90ce2f661a841324b163f97e208c44d8d1e8817",
                "md5": "1d4e276de189329ff6e20058327e1629",
                "sha256": "286faf974decd2ecd7c62c56501bc16f1463554eb7770238ec1aa5eb8f025123"
            },
            "downloads": -1,
            "filename": "rushdb-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1d4e276de189329ff6e20058327e1629",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 20816,
            "upload_time": "2025-02-14T18:33:37",
            "upload_time_iso_8601": "2025-02-14T18:33:37.134483Z",
            "url": "https://files.pythonhosted.org/packages/31/8c/df2fa5e66baf270b6b58f90ce2f661a841324b163f97e208c44d8d1e8817/rushdb-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "89e92aec99d763a2b9bc03766e833088019e229c2ca869ac76cbe35d32f332db",
                "md5": "d26439a23dd6696eef9fa31da96217b2",
                "sha256": "6bacb664798eecd448901d89bfde7f81e58ac2df8bb48d1f119710fdbc2ca31e"
            },
            "downloads": -1,
            "filename": "rushdb-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d26439a23dd6696eef9fa31da96217b2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 21122,
            "upload_time": "2025-02-14T18:33:39",
            "upload_time_iso_8601": "2025-02-14T18:33:39.111280Z",
            "url": "https://files.pythonhosted.org/packages/89/e9/2aec99d763a2b9bc03766e833088019e229c2ca869ac76cbe35d32f332db/rushdb-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-14 18:33:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rushdb",
    "github_project": "rushdb-python",
    "github_not_found": true,
    "lcname": "rushdb"
}
        
Elapsed time: 1.70070s