How to escape field name in orientdb

346 Views Asked by At

I'm having a class with fields like from and to in an orientdb database.

How do I execute a query that select the from and to fields?

I tried select [from] from Activity but it is complaining about [.

2

There are 2 best solutions below

7
On BEST ANSWER

You have to disable the strictSql using this command:

ALTER DATABASE custom strictSql=false

and then you have to use the backtick:

SELECT `from` FROM Activity
0
On

FROM and TO are reserved words. So you could just change the name or backtick them. Example:

select `from` from Activity