@@ -4,7 +4,11 @@ ArcadeDB Python bindings provide **two distinct access methods** that can be use
44
55## Java API (Embedded Mode)
66
7- Direct JVM method calls via JPype - ** recommended for most Python applications** .
7+ Direct JVM method calls via JPype for embedded/local runtime access.
8+
9+ !!! note "DSL-first guidance"
10+ Prefer SQL/OpenCypher via ` db.command(...) ` and ` db.query(...) ` for schema, CRUD, and graph operations.
11+ Wrapper APIs remain available, but examples and guides are standardized on DSL usage.
812
913### Characteristics
1014
@@ -23,16 +27,13 @@ import arcadedb_embedded as arcadedb
2327# Direct database access - NO server needed
2428with arcadedb.create_database(" ./mydb" ) as db:
2529 # Create schema (auto-transactional)
26- db.schema.create_document_type( " Person" )
27- db.schema.create_property( " Person " , " name" , " STRING" )
28- db.schema.create_property( " Person " , " age" , " INTEGER" )
30+ db.command( " sql " , " CREATE DOCUMENT TYPE Person" )
31+ db.command( " sql " , " CREATE PROPERTY Person. name STRING" )
32+ db.command( " sql " , " CREATE PROPERTY Person. age INTEGER" )
2933
3034 # Insert data (requires transaction)
3135 with db.transaction():
32- person = db.new_document(" Person" )
33- person.set(" name" , " Alice" )
34- person.set(" age" , 30 )
35- person.save()
36+ db.command(" sql" , " INSERT INTO Person SET name = 'Alice', age = 30" )
3637
3738 # Query data (SQL is fine for reads)
3839 result = db.query(" sql" , " SELECT FROM Person WHERE age > 25" )
5455 db = server.create_database(" mydb" )
5556
5657 # Schema operations are auto-transactional
57- db.schema.create_document_type( " Person" )
58- db.schema.create_property( " Person " , " name" , " STRING" )
59- db.schema.create_property( " Person " , " age" , " INTEGER" )
58+ db.command( " sql " , " CREATE DOCUMENT TYPE Person" )
59+ db.command( " sql " , " CREATE PROPERTY Person. name STRING" )
60+ db.command( " sql " , " CREATE PROPERTY Person. age INTEGER" )
6061
6162 # Data operations require explicit transactions
6263 with db.transaction():
63- person = db.new_document(" Person" )
64- person.set(" name" , " Alice" )
65- person.set(" age" , 30 )
66- person.save()
64+ db.command(" sql" , " INSERT INTO Person SET name = 'Alice', age = 30" )
6765
6866 result = db.query(" sql" , " SELECT FROM Person WHERE age > 25" )
6967 for record in result:
130128 if not response.ok:
131129 raise RuntimeError (f " Insert failed: { response.status_code} { response.text} " )
132130 # Note: HTTP commands are auto-transactional per request. For multi-statement atomicity, use
133- # the HTTP transactional endpoints or perform batch writes with the embedded API via
134- # `with db.transaction():`.
131+ # the HTTP transactional endpoints or embedded `with db.transaction():` blocks.
135132
136133 # Query data via HTTP
137134 response = requests.post(
@@ -205,16 +202,13 @@ try:
205202 db = server.create_database(" hybriddb" )
206203
207204 # Schema operations are auto-transactional
208- db.schema.create_document_type( " Person" )
209- db.schema.create_property( " Person " , " name" , " STRING" )
210- db.schema.create_property( " Person " , " age" , " INTEGER" )
205+ db.command( " sql " , " CREATE DOCUMENT TYPE Person" )
206+ db.command( " sql " , " CREATE PROPERTY Person. name STRING" )
207+ db.command( " sql " , " CREATE PROPERTY Person. age INTEGER" )
211208
212209 # Data operations require explicit transactions
213210 with db.transaction():
214- person = db.new_document(" Person" )
215- person.set(" name" , " Alice" )
216- person.set(" age" , 30 )
217- person.save()
211+ db.command(" sql" , " INSERT INTO Person SET name = 'Alice', age = 30" )
218212
219213 # Query same data using HTTP API (remote access)
220214 auth = HTTPBasicAuth(" root" , " password123" )
@@ -248,11 +242,11 @@ finally:
248242
249243## When to Use Each
250244
251- ### Use Java API When:
245+ ### Use Embedded Mode When:
252246
253247- Single Python process application
254248- Maximum performance required
255- - Complex data manipulation
249+ - Local SQL/OpenCypher workflows
256250- Batch processing
257251- Local development/testing
258252
@@ -265,16 +259,16 @@ finally:
265259- Microservices architecture
266260- Cross-network access
267261
268- ### Use Both When:
262+ ### Use Hybrid Access When:
269263
270264- Local high-performance operations + remote monitoring
271265- Hybrid applications with embedded + web components
272- - Development (Java API ) + production monitoring (HTTP API)
266+ - Development (embedded ) + production monitoring (HTTP API)
273267
274268## Common Misconceptions
275269
276- - ❌ ** "Java API is only for Java"**
277- - ✅ Java API is Python calling Java via JPype (fully Pythonic)
270+ - ❌ ** "Embedded mode is only for Java"**
271+ - ✅ Embedded mode is Python calling Java via JPype (fully Pythonic)
278272- ❌ ** "HTTP API is inferior"**
279273 - ✅ HTTP API enables remote access (different purpose)
280274- ❌ ** "Must choose one or the other"**
0 commit comments