orientechnologies / orientdb

OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
https://orientdb.dev
Apache License 2.0
4.75k stars 871 forks source link

[enhancement] insert multiple schemaless records using JSON #4795

Closed electricjones closed 3 years ago

electricjones commented 9 years ago

This is originally from https://groups.google.com/forum/#!topic/orient-database/A2eJvthrYnk. It was suggested I open an enhancement ticket.

I have three records that I need to insert in a single query:

{name: 'mal', role: 'captain', ship: 'firefly'}
{name: 'zoe', role: 'first', husband: 'wash'}
{name: 'book', role: 'shephard', past: 'unknown'}

What I really want is for this to be possible:

INSERT INTO characters CONTENT {}, {}, {}

Obviously with the correct JSON content. But that throws errors.

The only alternative I can find is following the VALUES syntax like

INSERT INTO characters (name, role, ship, husband, past) 
VALUES
('mal', 'captain', 'firefly', null, null),
('zoe', 'first', null, 'wash', null),
('book', 'shephard', null, null, 'unknown')

However, building this programatically (like inside a query builder) is a nightmare.

soyayaos commented 9 years ago

What I really want is for this to be possible: INSERT INTO characters CONTENT {}, {}, {}

or: INSERT INTO characters CONTENT [{}, {}, {}]

electricjones commented 9 years ago

:+1:

healiseu commented 8 years ago

This is cool, nice catch @chrismichaels84. Kudos to your team @luigidellaquila and @lvca when you manage this enhancement in version 2.2.0-beta :+1: