-
Notifications
You must be signed in to change notification settings - Fork 82
Oracle Adapter
Develop another adapter for Cloudberry to support Oracle as a backend database.
Since OracleDB
does not support if exists
syntax, writing PL/SQL
will be required. The PL/SQL
requires checking the table space, so the Oracle
user must create an user named BERRY
to use the OracleAdapter
.
Changes | Explanation |
---|---|
Convert if exists to pl/sql
|
Oracle 's syntax does not support keyword if exists , creating berry.meta , dropping table, and creating view's if exists should be replaced to pl/sql . (Raw Data / Meta Data) |
limit |
In Oracle fetch first n rows is equivalent to limit (Raw Data/Meta Data) |
replace into |
replace in to is used when creating a view in the database. merge into can be used in Oracle instead (Raw Data / Meta Data) |
group by |
In MySQL the select clause executes first, but in Oracle where clause executes first. Changes in the function of parsing group by. (Raw Data) |
Extracting time units | In MySQL there are functions to extract a certain time field, and the usage in Oracle is different. (Raw Data) |
Full text search | Different syntax (Raw Data) |
Adding quotations | Currently, names such as berry.meta , stats.creatTime are all using quotations to correspond to AsterixDB (Same in MySQL ) (Meta Data / Raw Data) |
Geo DataType | In AsterixDB the built-in data type Point could be queried by directly using select t.coordinate , but Oracle 's SDO_GEOMETRY type requires different syntax |
parseTimeRelation
parseTextRelation
parseDrop
parseCreate
parseSelect
parseGroupByFunc
parseGroupBy
parseUpssertMeta
fieldType2SQLType
-
postGeneralQuery
inOracleConn
- Since Oracle DB does not support latest MAC OS X, we install Oracle 12c on a Linux machine, and run Cloudberry and Twittermap on a MAC machine.
(NOTE: This is the only step done on a Linux machine.)
Following link is a sample guidance for installing Oracle DB 12c on CentOS 7: https://www.tecmint.com/install-oracle-database-12c-on-centos-7/ If you are using other versioned Linux/Windows systems, please find relevant resources online.
create user berry identified by orcl;
grant connect, resource, dba to berry;
brew install python
pip3 install cx_Oracle --upgrade --user
(reference: https://cx-oracle.readthedocs.io/en/latest/installation.html#installing-cx-oracle-on-macos)
cd cloudberry/examples/twittermap
# If you have different username/password or hostname or SID or your oracle configuration, you'll need to modify the link [con = cx_Oracle.connect('berry/orcl@localhost:1521/orcl')] inside those two scripts: ingestOracledata.py, ingestpopulationOracle.py
./script/OracleTwittermapIngestion.sh
Modify cloudberry/neo/conf/applicaiton.conf
:
#asterixdb.lang = SQLPP # comment this line
asterixdb.lang = oracle # uncomment this line
oracledb.url = "jdbc:oracle:thin:berry/orcl@localhost:1521:orcl" # uncomment this line with url of your oracle
Done!
Now you can start Cloudberry and Twittermap as before.