Skip to content

Commit

Permalink
Bug/92 schema name property (#93)
Browse files Browse the repository at this point in the history
Co-authored-by: Christoph Pirkl <christoph.pirkl@exasol.com>
  • Loading branch information
ckunki and kaklakariada authored Mar 10, 2023
1 parent 0b9817b commit 8136ef9
Show file tree
Hide file tree
Showing 16 changed files with 212 additions and 66 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/broken_links_checker.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/ci-build-next-java.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
DEFAULT_DB_VERSION: "7.1.17"
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.docker_db_version }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -58,4 +58,4 @@ jobs:
-Dsonar.login=$SONAR_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 changes: 1 addition & 1 deletion .project-keeper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ sources:
linkReplacements:
excludes:
- "E-PK-CORE-18: Outdated content: '.github/workflows/ci-build.yml'"
- "E-PK-CORE-18: Outdated content: '.github/workflows/release_droid_upload_github_release_assets.yml'"
- regex: "(?s)E-PK-CORE-53: The dependencies.md file has outdated content.*"
2 changes: 1 addition & 1 deletion dependencies.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions doc/changes/changelog.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions doc/changes/changes_7.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Exasol Virtual Schema 7.1.0, released 2023-03-10

Code name: Mandatory Property SCHEMA_NAME

## Summary

This release updates VSEXA to take virtual schema property `SCHEMA_NAME` as mandatory in order to fix a bug when the property is not set.

## Bugfixes

* #92: Fixed broken handling of tables when `SCHEMA_NAME` property is not set

## Dependency Updates

### Compile Dependency Updates

* Updated `com.exasol:error-reporting-java:1.0.0` to `1.0.1`
* Updated `com.exasol:virtual-schema-common-jdbc:10.1.0` to `10.2.0`

### Test Dependency Updates

* Updated `com.exasol:exasol-testcontainers:6.5.0` to `6.5.1`
* Updated `com.exasol:test-db-builder-java:3.4.1` to `3.4.2`
* Updated `com.exasol:virtual-schema-common-jdbc:10.1.0` to `10.2.0`
* Updated `org.mockito:mockito-junit-jupiter:5.0.0` to `5.1.1`

### Plugin Dependency Updates

* Updated `com.exasol:error-code-crawler-maven-plugin:1.2.1` to `1.2.2`
* Updated `com.exasol:project-keeper-maven-plugin:2.9.1` to `2.9.3`
* Updated `org.apache.maven.plugins:maven-dependency-plugin:3.3.0` to `3.5.0`
* Updated `org.apache.maven.plugins:maven-failsafe-plugin:3.0.0-M7` to `3.0.0-M8`
* Updated `org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7` to `3.0.0-M8`
* Updated `org.codehaus.mojo:versions-maven-plugin:2.13.0` to `2.14.2`
2 changes: 1 addition & 1 deletion doc/dialects/exasol.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE JAVA ADAPTER SCRIPT SCHEMA_FOR_VS_SCRIPT.ADAPTER_SCRIPT_EXASOL AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtual-schema-dist-10.1.0-exasol-7.0.2.jar;
%jar /buckets/<BFS service>/<bucket>/virtual-schema-dist-10.2.0-exasol-7.1.0.jar;
/
```

Expand Down
2 changes: 1 addition & 1 deletion error_code_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ error-tags:
VSEXA:
packages:
- com.exasol.adapter.dialects.exasol
highest-index: 5
highest-index: 6
14 changes: 8 additions & 6 deletions pk_generated_parent.pom

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>exasol-virtual-schema</artifactId>
<version>7.0.2</version>
<version>7.1.0</version>
<name>Exasol Virtual Schema</name>
<description>This projects contains the Exasol dialect for Exasol's Virtual Schema</description>
<url>https://github.com/exasol/exasol-virtual-schema/</url>
<properties>
<vscjdbc.version>10.1.0</vscjdbc.version>
<vscjdbc.version>10.2.0</vscjdbc.version>
</properties>
<distributionManagement>
<snapshotRepository>
Expand All @@ -33,7 +33,7 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>error-reporting-java</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
Expand Down Expand Up @@ -64,14 +64,14 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.0.0</version>
<version>5.1.1</version>
<scope>test</scope>
</dependency>
<!--Integration test dependencies -->
<dependency>
<groupId>com.exasol</groupId>
<artifactId>exasol-testcontainers</artifactId>
<version>6.5.0</version>
<version>6.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -95,7 +95,7 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>test-db-builder-java</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -110,7 +110,7 @@
<plugin>
<groupId>com.exasol</groupId>
<artifactId>project-keeper-maven-plugin</artifactId>
<version>2.9.1</version>
<version>2.9.3</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -195,7 +195,7 @@
<parent>
<artifactId>exasol-virtual-schema-generated-parent</artifactId>
<groupId>com.exasol</groupId>
<version>7.0.2</version>
<version>7.1.0</version>
<relativePath>pk_generated_parent.pom</relativePath>
</parent>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.exasol.adapter.dialects.*;
import com.exasol.adapter.dialects.rewriting.SqlGenerationContext;
import com.exasol.adapter.jdbc.*;
import com.exasol.adapter.properties.*;
import com.exasol.errorreporting.ExaError;

/**
Expand All @@ -23,6 +24,7 @@ public class ExasolSqlDialect extends AbstractSqlDialect {
static final String EXASOL_TIMESTAMP_WITH_LOCAL_TIME_ZONE_SWITCH = "TIMESTAMP_WITH_LOCAL_TIME_ZONE_USAGE";
static final String NAME = "EXASOL";
private static final Capabilities CAPABILITIES = createCapabilityList();
private final ValidatorChain dialectPropertyValidators;

/**
* Create a new instance of the {@link ExasolSqlDialect}.
Expand All @@ -33,6 +35,10 @@ public class ExasolSqlDialect extends AbstractSqlDialect {
public ExasolSqlDialect(final ConnectionFactory connectionFactory, final AdapterProperties properties) {
super(connectionFactory, properties, Set.of(CATALOG_NAME_PROPERTY, SCHEMA_NAME_PROPERTY, EXASOL_IMPORT_PROPERTY,
EXASOL_CONNECTION_PROPERTY, IS_LOCAL_PROPERTY, IGNORE_ERRORS_PROPERTY));
this.dialectPropertyValidators = PropertyValidator.chain() //
.add(SchemaNameProperty.validator(NAME)) //
.add(BooleanProperty.validator(EXASOL_IMPORT_PROPERTY)) //
.add(BooleanProperty.validator(IS_LOCAL_PROPERTY));
this.omitParenthesesMap.addAll(Set.of(SYSDATE, SYSTIMESTAMP, CURRENT_SCHEMA, CURRENT_SESSION, CURRENT_STATEMENT,
CURRENT_USER, CURRENT_CLUSTER));
}
Expand Down Expand Up @@ -140,8 +146,7 @@ public String getStringLiteral(final String value) {
public void validateProperties() throws PropertyValidationException {
super.validateProperties();
checkImportPropertyConsistency(EXASOL_IMPORT_PROPERTY, EXASOL_CONNECTION_PROPERTY);
validateBooleanProperty(EXASOL_IMPORT_PROPERTY);
validateBooleanProperty(IS_LOCAL_PROPERTY);
this.dialectPropertyValidators.validate(this.properties);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.exasol.adapter.dialects.exasol;

import com.exasol.adapter.AdapterProperties;
import com.exasol.adapter.properties.PropertyValidationException;
import com.exasol.adapter.properties.PropertyValidator;
import com.exasol.errorreporting.ExaError;

/**
* {@link PropertyValidator} for validation of a mandatory property.
*/
public class MandatoryProperty implements PropertyValidator {
/**
* Create a new validator.
*
* @param dialect name of the current virtual schema dialect to be included in error message
* @param element label for the missing property value
* @param property name of the property
* @return new instance of {@link PropertyValidator} for validation of a mandatory property.
*/
public static PropertyValidator validator(final String dialect, final String element, final String property) {
return new MandatoryProperty(dialect, element, property);
}

private final String dialect;
private final String element;
private final String property;

private MandatoryProperty(final String dialect, final String element, final String property) {
this.dialect = dialect;
this.element = element;
this.property = property;
}

@Override
public void validate(final AdapterProperties properties) throws PropertyValidationException {
if (!properties.hasSchemaName()) {
throw new PropertyValidationException(ExaError.messageBuilder("E-VSEXA-6")
.message("{{dialect|uq}} virtual schema dialect requires to specify a {{element1|uq}}.",
this.dialect, this.element) //
.mitigation("Please specify a {{element2|uq}} using property {{property}}.", //
this.element, this.property) //
.toString());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.exasol.adapter.dialects.exasol;

import com.exasol.adapter.AdapterProperties;
import com.exasol.adapter.properties.PropertyValidator;

/**
* Validator for property {@link AdapterProperties#SCHEMA_NAME_PROPERTY}
*/
public class SchemaNameProperty {
/**
* @param dialect name of the current dialect
* @return {@link PropertyValidator} for mandatory property {@link AdapterProperties#SCHEMA_NAME_PROPERTY}.
*/
public static PropertyValidator validator(final String dialect) {
return MandatoryProperty.validator(dialect, "schema name", AdapterProperties.SCHEMA_NAME_PROPERTY);
}

private SchemaNameProperty() {
// only static usage
}
}
Loading

0 comments on commit 8136ef9

Please sign in to comment.