Closed SameerChorge94 closed 3 years ago
I was able to create the class with below batch query:
BEGIN;
LET typeInstest1 = CREATE CLASS test1 IF NOT EXISTS EXTENDS V;
LET typePropInstest10 = create Property test1.name String;
LET typePropInstest11 = create Property test1.description String;
COMMIT;
return typeInstest1;
but it fails after creating the class only and throws error and does not create the properties for the class it returns the below error:
'Cannot change the schema while a transaction is active. Schema changes are not transactional\r\n' +
'\tDB name="test"'
Is there any workoround which i can use to create the multiple Class and it's properties in single batch query.
Hi @SameerChorge94
The only problem here is that the schema cannot be updated inside a transaction, so you have to omit the BEGIN/COMMIT:
LET typeInstest1 = CREATE CLASS test1 IF NOT EXISTS EXTENDS V;
LET typePropInstest10 = create Property test1.name String;
LET typePropInstest11 = create Property test1.description String;
return typeInstest1;
Thanks
Luigi
@luigidellaquila Thank you above solution worked for me.
Description: I'm trying to run the batch query using orientJs client for creating the multiple classes and it's respective properties. But getting the request Error parsing query error with below query.
Batch Query:
If I execute the normal insert queries in batch then t works without issues refer below example
Expected Result: Above batch query should create 2 classes and it's respective properties in orientDB
Acutal Result: After executing the above query using orientJsClientDBSession.batch(BATCH_QUERY) it's returning the parsing error Complete Error Response:
OrientDB Version:
OrientJs version:
orientjs: "^3.0.11"