Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Destination Oracle: Fix destination check for users without dba role #5307

Merged
merged 7 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ COPY build/distributions/${APPLICATION}*.tar ${APPLICATION}.tar

RUN tar xf ${APPLICATION}.tar --strip-components=1

LABEL io.airbyte.version=0.1.4
LABEL io.airbyte.version=0.1.5
LABEL io.airbyte.name=airbyte/destination-oracle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public OracleOperations(String tablespace) {

@Override
public void createSchemaIfNotExists(JdbcDatabase database, String schemaName) throws Exception {
if (database.queryInt("select count(*) from dba_users where upper(username) = upper(?)", schemaName) == 0) {
if (database.queryInt("select count(*) from all_users where upper(username) = upper(?)", schemaName) == 0) {
LOGGER.warn("Schema " + schemaName + " is not found! Trying to create a new one.");
final String query = String.format("create user %s identified by %s quota unlimited on %s",
schemaName, schemaName, tablespace);
database.execute(query);
Expand Down
12 changes: 11 additions & 1 deletion docs/integrations/destinations/oracle.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@ Make sure your Oracle database can be accessed by Airbyte. If your database is w

#### **Permissions**

You need an Oracle user with permissions to create tables and write rows, and to create other users with the same permissions in order to support namespaces. We highly recommend creating an Airbyte-specific user for this purpose.
As Airbyte namespaces allows us to store data into different schemas, we have different scenarios and list of required permissions:

| Login user | Destination user | Required permissions | Comment |
| :--- | :--- | :--- | :--- |
| DBA User | Any user | - | |
| Regular user | Same user as login | Create, drop and write table, create session | |
| Regular user | Any existing user | Create, drop and write ANY table, create session | Grants can be provided on a system level by DBA or by target user directly |
| Regular user | Not existing user | Create, drop and write ANY table, create user, create session | Grants should be provided on a system level by DBA |

We highly recommend creating an Airbyte-specific user for this purpose.

### Setup the Oracle destination in Airbyte

Expand All @@ -53,6 +62,7 @@ You should now have all the requirements needed to configure Oracle as a destina
## Changelog
| Version | Date | Pull Request | Subject |
| :--- | :--- | :--- | :--- |
| 0.1.5 | 2021-08-10 | [#5307](https://github.com/airbytehq/airbyte/pull/5307) | 🐛 Destination Oracle: Fix destination check for users without dba role |
| 0.1.4 | 2021-07-30 | [#5125](https://github.com/airbytehq/airbyte/pull/5125) | Enable `additionalPropertities` in spec.json |
| 0.1.3 | 2021-07-21 | [#3555](https://github.com/airbytehq/airbyte/pull/3555) | Partial Success in BufferedStreamConsumer |
| 0.1.2 | 2021-07-20 | [4874](https://github.com/airbytehq/airbyte/pull/4874) | Require `sid` instead of `database` in connector specification |