Created
April 15, 2025 04:00
-
-
Save jalakoo/8dac1f705214de68eda3a2e720b9a0e7 to your computer and use it in GitHub Desktop.
Super Simple RushDB Python Sample App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rushdb import RushDB | |
# Initialize the RushDB client | |
client = RushDB( | |
"<your_locally_generated_api_key>", | |
base_url="http://localhost:3000", | |
) | |
# Simple - Create a single Node | |
single_record = { | |
"name": "Google LLC", | |
"address": "1600 Amphitheatre Parkway", | |
"foundedAt": "1998-09-04T00:00:00.000Z", | |
"rating": 4.9, | |
} | |
# Nest - Create multiple Nodes + Relationships | |
multiple_records = { | |
"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": "[email protected]", | |
"dob": "1968-07-16T00:00:00.000Z", | |
"salary": 3000000, | |
} | |
], | |
} | |
], | |
} | |
], | |
} | |
record = client.records.create_many( | |
label="Company", | |
data=multiple_records, | |
options={"returnResult": True, "suggestTypes": True}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment