OrientDB 3.0.4 Console EMBEDDEDLIST CREATE VERTEX - console

It appears that console application in OrientDB 3.0.4 is not backward compatible with OrientDB 3.0.2 for creating Vertex having EMBEDDEDLIST.
Following Query fails in OrientDB 3.0.4 console:
CREATE VERTEX Profile SET name = "John", phone = [{ "#type":"d", "number" : "212" }]
How can I resolve the issue?
What are the changes for v3.0.4 and where can I find updated documentation?
OrientDB console v.3.0.2 - Veloce (build e47e693f1470a7a642461be26983d4eca70777fd, branch develop)
OrientDB console v.3.0.2 - Veloce (build e47e693f1470a7a642461be26983d4eca70777fd, branch develop) https://www.orientdb.com
Type 'help' to display all the supported commands.
orientdb> create database remote:localhost/mydb root orientdb
Creating database [remote:localhost/mydb] using the storage type [PLOCAL]...
Database created successfully.
Current database is: remote:localhost/mydb
orientdb {db=mydb}> create class Phone EXTENDS V
Class created successfully.
orientdb {db=mydb}> create property Phone.number String
Property created successfully.
orientdb {db=mydb}> create class Profile EXTENDS V
Class created successfully.
orientdb {db=mydb}> create property Profile.name String
Property created successfully.
orientdb {db=mydb}> create property Profile.phone embeddedList Phone
Property created successfully.
orientdb {db=mydb}> CREATE VERTEX Profile SET name = "John", phone = [{ "#type":"d", "number" : "212" }]
Created vertex '[Profile#33:0{name:John,phone:[1]} v1]' in 0.023000 sec(s).
-------
OrientDB console v.3.0.4 - Veloce (build 4578b51f72a55feaa0852bc8ddd52929011d956c, branch 3.0.x)
OrientDB console v.3.0.4 - Veloce (build 4578b51f72a55feaa0852bc8ddd52929011d956c, branch 3.0.x) https://www.orientdb.com
Type 'help' to display all the supported commands.
orientdb> create database remote:localhost/mydb root orientdb
Creating database [remote:localhost/mydb] using the storage type [PLOCAL]...
Database created successfully.
Current database is: remote:localhost/mydb
orientdb {db=mydb}> create class Phone EXTENDS V
Class created successfully.
orientdb {db=mydb}> create property Phone.number String
Property created successfully.
orientdb {db=mydb}> create class Profile EXTENDS V
Class created successfully.
orientdb {db=mydb}> create property Profile.name String
Property created successfully.
orientdb {db=mydb}> create property Profile.phone embeddedList Phone
Property created successfully.
orientdb {db=mydb}> CREATE VERTEX Profile SET name = "John", phone = [{ "#type":"d", "number" : "212" }]
Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:
create VERTEX Profile SET name = "John", phone = [{ "#type":"d", "number" : "212" }
^
Encountered " "[" "[ "" at line 1, column 50.
Was expecting one of:
...
...
...
"{" ...
...
...
...
"{" ...
"{" ...
...
...
...
"{" ...
"{" ...
"{" ...
...
...
...
"{" ...
"{" ...
...
...
...
"{" ...
"{" ...
...
...
...
"{" ...
"{" ...
"{" ...
DB name="mydb"
Error Code="1"
DB name="mydb"
!Unrecognized command: ']'
orientdb {db=mydb}>

The issue is that you've declared your property as "Phone" and then you're trying to create your vertex using the name "phone" in lowercase which doesn't match the schema.
Also there's no need to use square brackets so instead of that last query, try using:
CREATE VERTEX Profile SET name = "John", Phone = { "#type":"d", "number" : "212"}

Related

Is there any way to create a default account whenever a node is created?

I am using Corda version 4.3 and doing all the transactions on the account level by creating accounts for each node. However, I want that whenever I create a node a default account gets created so that no node is created without an account.
I wonder if I can do that in the RPC settings or in the main build.gradle file where I initialize a node like this :
node {
name "O=Node1,L=London,C=GB"
p2pPort 10005
rpcSettings {
address("localhost:XXXXX")
adminAddress("localhost:XXXXX")
}
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
Try the following:
Create a class and annotate it as #CordaService -which means this class gets loaded as soon as the node starts- (https://docs.corda.net/api/kotlin/corda/net.corda.core.node.services/-corda-service/index.html).
Inside your service class:
Fetch the default account (AccountService class from the Accounts library has methods to fetch and create accounts; it's inside com.r3.corda.lib.accounts.workflows.services).
If the default account is not found, create it.

Error while editing existing GSI on my scheme

I am using AppSync with DynamoDB and GraphQL API. My current scheme works as expected but when trying to edit existing GSI I am getting an error.
My current scheme looks like this:
type Item #model
#key(fields: ["id", "version"])
#key(name: "type-subtype", fields: ["type", "subtype"])
{
id: ID!
version: String!
type: String!
subtype: String!
}
I want to change GSI defined here to be:
#key(name: "version-type-subtype", fields: ["version", "type", "subtype"]
The error I am getting is Schema Creation Status is FAILED with details: Failed to parse schema document - ensure it's a valid SDL-formatted document.
Can someone help? Is there any constraint using sort key from primary index as hash in GSI that I am not aware of?
Thanks

Query in command must target a single shard key

I'm trying to insert multiple documents to Cosmos DB with Mongo Api which has a shard key as follows,
insertAll(trips.stream().map(t -> Document.parse(gson.toJson(t))).collect(Collectors.toList()),"trip");
insertAll method is as follows,
private void insertAll(List<Document> data, String collectionName) {
MongoCollection<Document> collection = mongoTemplate.getCollection(collectionName);
collection.insertMany(data);
}
And the documents I'm trying to insert are as follows,
Document{{sensorId=b827ebe942b7, liftId=1edb945b-29e7-c6c7-d20b-87c0, timestamp=1554902007838, ..............}}
Even though I'm providing the shard key which is liftId I get a exception saying single shard key must be provided.
Command failed with error 61: 'query in command must target a single shard key' on server cdb-ms-prod-southeastasia1-fd10.documents.azure.com:10255.
The full response is { "_t" : "OKMongoResponse", "ok" : 0, "code" : 61, "errmsg" : "query in command must target a single shard key", "$err" : "query in command must target a single shard key" }; nested exception is com.mongodb.MongoCommandException: Command failed with error 61: 'query in command must target a single shard key' on server cdb-ms-...-fd10.documents.azure.com:someport. The full response is { "_t" : "OKMongoResponse", "ok" : 0, "code" : 61, "errmsg" : "query in command must target a single shard key", "$err" : "query in command must target a single shard key" }
Any help to fix this? I'm using spring data mongodb

Corda: Trying to put the RPC Permissions on an external database

I'm trying to put the RPC Permissions, along with the users and their password on an external database. I've followed the documentation for Corda v. 3.3 (https://docs.corda.net/clientrpc.html#rpc-security-management).
It says that I need to create a "security" field for the node in question and fill out all the necessary information. I've done it, but as soon as I try to deploy the Node, it gives me this error:
"Could not set unknown property 'security' for object of type net.corda.plugins.Node."
The node's information looks like this in the build.gradle document:
node {
name "O=myOrganisation,L=Lisbon,C=PT"
p2pPort 10024
rpcSettings {
address("localhost:10025")
adminAddress("localhost:10026")
}
security = {
authService = {
dataSource = {
type = "DB"
passwordEncryption = "SHIRO_1_CRYPT"
connection = {
jdbcUrl = "localhost:3306"
username = "*******"
password = "*******"
driverClassName = "com.mysql.jdbc.Driver"
}
}
}
}
cordapps = [
"$project.group:cordapp:$project.version"
]
}
You are confusing two syntaxes:
The syntax for configuring a node block inside a Cordform task such as deployNodes
The syntax for configuring a node directly via node.conf
The security settings are for inside node.conf. You have to create the node first, then modify the node's node.conf with these settings once it has been created.
Corda 4 will introduce an extraConfig option for use inside Cordfrom node blocks, as described here.

Flyway "ORA-00955: name is already used by an existing object"

We are trying to use Flyway to manage our database schema updates with the following spring-boot configuration:
spring:
datasource:
driver-class-name: oracle.jdbc.OracleDriver
password: ${java_user_password}
url: ${DB_URL}
username: JAVA_USER
flyway:
locations: classpath:/db/migration
user: SUPER_USER
password: ${password_of_super_user}
baseline-on-migrate: true
url: ${DB_URL}
schema: JAVA_USER
Flyway version 5.1.4.
The configuration is working in Oracle 12.1.0.2.0 Standard Edition but not in Enterprise edition. We keep getting the following error:
SQL State : 42000
Error Code : 955
Message : ORA-00955: name is already used by an existing object
Line : 17
Statement : CREATE TABLE "JAVA_USER"."flyway_schema_history" (
"installed_rank" INT NOT NULL,
"version" VARCHAR2(50),
"description" VARCHAR2(200) NOT NULL,
"type" VARCHAR2(20) NOT NULL,
"script" VARCHAR2(1000) NOT NULL,
"checksum" INT,
"installed_by" VARCHAR2(100) NOT NULL,
"installed_on" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
"execution_time" INT NOT NULL,
"success" NUMBER(1) NOT NULL
)
Any idea why? Before starting the spring-boot application we delete all objects under the schemas.
Thanks!

Resources