Skip to content

hasura/hasura-oracle-fdw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Using oracle_fdw with Hasura Cloud and AWS RDS

Requirements

  • Hasura Cloud application
  • AWS RDS Postgres database
  • Oracle database

Instructions

  1. Connect the RDS Postgres to your Hasura Cloud application

  2. In your Postgres database, run the following commands to install the oracle_fdw extension and connect your Oracle database (filling in the correct connection string and credentials for your Oracle connection)

    • NOTE: You can do this via psql, the Hasura web console UI's "Run SQL" page, or any other database administration tool you prefer

CREATE EXTENSION oracle_fdw;

CREATE SERVER oradb
    FOREIGN DATA WRAPPER oracle_fdw
    OPTIONS (dbserver '//database-2.xxxxxxxx.us-east-1.rds.amazonaws.com:1521/mydb');

CREATE USER MAPPING FOR postgres
    SERVER oradb
    OPTIONS (user 'admin', password 'mypassword');
  1. For each table you would like to access through Hasura, use the CREATE FOREIGN TABLE() statement to wire up the foreign table connection. The below example creates a foreign table in Postgres called genre_oracle that maps to the remote table GENRE in the Oracle database:
CREATE FOREIGN TABLE genre_oracle (
    GenreId int NOT NULL,
    Name varchar(120)
)
    SERVER oradb
    OPTIONS (table 'GENRE');
  1. Make sure that the newly-created foreign tables you want to query from Hasura are "tracked"

  2. Now, all foreign tables created should be available for querying and insert/delete mutations. You can run a GraphQL query against the foreign table to test that it is working and returning the data you expect.

    • For example, using the table names given above, something like:
query {
    # Query "GENRE" table in Oracle
    genre_oracle {
        GenreId
        Name
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published