Skip to content

Commit

Permalink
#267: added MySQL catalog support (#268)
Browse files Browse the repository at this point in the history
* #267: added catalog support
* #267: removed schema support
  • Loading branch information
AnastasiiaSergienko authored Sep 24, 2019
1 parent 7fcead9 commit 09533ce
Show file tree
Hide file tree
Showing 25 changed files with 41 additions and 42 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Supported dialects:
1. [Exasol](doc/dialects/exasol.md)
1. [Hive](doc/dialects/hive.md)
1. [Impala](doc/dialects/impala.md)
1. [MySQL](doc/dialects/mysql.md))
1. [MySQL](doc/dialects/mysql.md)
1. [Oracle](doc/dialects/oracle.md)
1. [PostgreSQL](doc/dialects/postgresql.md)
1. [Redshift](doc/dialects/redshift.md)
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/athena.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/AthenaJDBC42-<JDBC driver version>.jar;
/
;
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/aurora.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/postgresql-<JDBC driver version>.jar;
/
```
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/bigquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Please remember to check the versions of your JAR files after downloading driver
```sql
CREATE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/avro-1.8.2.jar;
%jar /buckets/<BFS service>/<bucket>/gax-1.40.0.jar;
%jar /buckets/<BFS service>/<bucket>/google-api-client-1.28.0.jar;
Expand Down
4 changes: 2 additions & 2 deletions doc/dialects/db2.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/db2jcc4.jar;
%jar /buckets/<BFS service>/<bucket>/db2jcc_license_cu.jar;
/
Expand All @@ -68,7 +68,7 @@ CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/db2jcc4.jar;
%jar /buckets/<BFS service>/<bucket>/db2jcc_license_cu.jar;
%jar /buckets/<BFS service>/<bucket>/db2jcc_license_cisuz.jar;
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/exasol.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
/
```

Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/hive.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/jars/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/jars/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/jars/HiveJDBC41.jar;
/
```
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/impala.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/ImpalaJDBC41.jar;
/
;
Expand Down
6 changes: 3 additions & 3 deletions doc/dialects/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/mysql-connector-java-<version>.jar;
/
;
Expand All @@ -70,15 +70,15 @@ IDENTIFIED BY '<password>';

## Creating a Virtual Schema

Below you see how a MySQL Virtual Schema is created.
Below you see how a MySQL Virtual Schema is created. Use CATALOG_NAME property to select a database.

```sql
CREATE VIRTUAL SCHEMA <virtual schema name>
USING ADAPTER.JDBC_ADAPTER
WITH
SQL_DIALECT = 'MYSQL'
CONNECTION_NAME = 'MYSQL_CONNECTION'
SCHEMA_NAME = '<schema name>';
CATALOG_NAME = '<database name>';
```

## Data Types Mapping and Limitations
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/oracle.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/ojdbc<JDBC driver version>.jar;
/
;
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/postgresql-<version>.jar;
/
```
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/redshift.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/RedshiftJDBC42-<JDBC driver version>.jar;
/
;
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/saphana.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/ngdbc-<JDBC driver version>.jar;
/
;
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/sql_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/jtds.jar;
/
```
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/sybase.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/jtds-<version>.jar;
/
```
Expand Down
2 changes: 1 addition & 1 deletion doc/dialects/teradata.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The SQL statement below creates the adapter script, defines the Java class that
```sql
CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/<BFS service>/<bucket>/terajdbc4.jar;
%jar /buckets/<BFS service>/<bucket>/tdgssconfig.jar;
/
Expand Down
8 changes: 4 additions & 4 deletions doc/user-guide/deploying_the_virtual_schema_adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cd virtual-schemas/jdbc-adapter/
mvn clean -DskipTests package
```

The resulting fat JAR is stored in `virtualschema-jdbc-adapter-dist/target/virtualschema-jdbc-adapter-dist-2.1.0.jar`.
The resulting fat JAR is stored in `virtualschema-jdbc-adapter-dist/target/virtualschema-jdbc-adapter-dist-2.1.1.jar`.

## Uploading the Adapter JAR Archive

Expand All @@ -46,8 +46,8 @@ Following steps are required to upload a file to a bucket:
1. Now upload the file into this bucket, e.g. using curl (adapt the hostname, BucketFS port, bucket name and bucket write password).

```bash
curl -X PUT -T virtualschema-jdbc-adapter-dist/target/virtualschema-jdbc-adapter-dist-2.1.0.jar \
http://w:[email protected]:2580/bucket1/virtualschema-jdbc-adapter-dist-2.1.0.jar
curl -X PUT -T virtualschema-jdbc-adapter-dist/target/virtualschema-jdbc-adapter-dist-2.1.1.jar \
http://w:[email protected]:2580/bucket1/virtualschema-jdbc-adapter-dist-2.1.1.jar
```

If you later need to change the bucket passwords, select the bucket and click "Edit".
Expand Down Expand Up @@ -84,7 +84,7 @@ CREATE SCHEMA ADAPTER;

CREATE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-2.1.0.jar;
%jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-2.1.1.jar;
%jar /buckets/your-bucket-fs/your-bucket/<JDBC driver>.jar;
/
```
Expand Down
2 changes: 1 addition & 1 deletion doc/user-guide/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Please note that the syntax for creating adapter scripts is not recognized by al
1. [EXASOL](../dialects/exasol.md)
1. [Hive](../dialects/hive.md)
1. [Impala](../dialects/impala.md)
1. [MySQL](doc/dialects/mysql.md))
1. [MySQL](../doc/dialects/mysql.md)
1. [Oracle](../dialects/oracle.md)
1. [PostgresSQL](../dialects/postgresql.md)
1. [Redshift](../dialects/redshift.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ general:
debugAddress: '192.168.0.12:3000' # Address which will be defined as DEBUG_ADDRESS in the virtual schemas
bucketFsUrl: http://exasol-host:2580/bucket1
bucketFsPassword: bucket1
jdbcAdapterPath: /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-2.1.0.jar
jdbcAdapterPath: /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-2.1.1.jar

exasol:
runIntegrationTests: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ general:
debugAddress: '192.168.0.12:3000' # Address which will be defined as DEBUG_ADDRESS in the virtual schemas
bucketFsUrl: http://exasol-host:2580/bucket1
bucketFsPassword: bucket1
jdbcAdapterPath: /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-2.1.0.jar
jdbcAdapterPath: /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-2.1.1.jar

exasol:
runIntegrationTests: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ general:
debug: true
debugAddress: ''
bucketFsUrl: http://127.0.0.1:6594/default
jdbcAdapterPath: /buckets/bfsdefault/default/virtualschema-jdbc-adapter-dist-2.1.0.jar
jdbcAdapterPath: /buckets/bfsdefault/default/virtualschema-jdbc-adapter-dist-2.1.1.jar
additionalJDBCDriverDir: /vagrant/drivers/

exasol:
Expand Down
2 changes: 1 addition & 1 deletion jdbc-adapter/local/integration-test-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ general:
debugAddress: '10.44.1.228:3000' # Address which will be defined as DEBUG_ADDRESS in the virtual schemas
bucketFsUrl: http://localhost:2580/jars
bucketFsPassword: public
jdbcAdapterPath: /buckets/bfsdefault/jars/virtualschema-jdbc-adapter-dist-2.1.0.jar
jdbcAdapterPath: /buckets/bfsdefault/jars/virtualschema-jdbc-adapter-dist-2.1.1.jar

exasol:
runIntegrationTests: true
Expand Down
2 changes: 1 addition & 1 deletion jdbc-adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<module>virtualschema-jdbc-adapter-dist</module>
</modules>
<properties>
<product.version>2.1.0</product.version>
<product.version>2.1.1</product.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>9</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
public class MySqlSqlDialect extends AbstractSqlDialect {
static final String NAME = "MYSQL";
private static final Capabilities CAPABILITIES = createCapabilityList();
private static final List<String> SUPPORTED_PROPERTIES = List.of(SQL_DIALECT_PROPERTY,
CONNECTION_NAME_PROPERTY, CONNECTION_STRING_PROPERTY, USERNAME_PROPERTY, PASSWORD_PROPERTY,
SCHEMA_NAME_PROPERTY, TABLE_FILTER_PROPERTY, EXCLUDED_CAPABILITIES_PROPERTY, DEBUG_ADDRESS_PROPERTY,
LOG_LEVEL_PROPERTY);
private static final List<String> SUPPORTED_PROPERTIES = List.of(SQL_DIALECT_PROPERTY, CONNECTION_NAME_PROPERTY,
CONNECTION_STRING_PROPERTY, USERNAME_PROPERTY, PASSWORD_PROPERTY, CATALOG_NAME_PROPERTY,
TABLE_FILTER_PROPERTY, EXCLUDED_CAPABILITIES_PROPERTY, DEBUG_ADDRESS_PROPERTY, LOG_LEVEL_PROPERTY);

/**
* Create a new instance of the {@link MySqlSqlDialect}.
Expand Down Expand Up @@ -77,12 +76,12 @@ public Capabilities getCapabilities() {

@Override
public StructureElementSupport supportsJdbcCatalogs() {
return StructureElementSupport.NONE;
return StructureElementSupport.MULTIPLE;
}

@Override
public StructureElementSupport supportsJdbcSchemas() {
return StructureElementSupport.MULTIPLE;
return StructureElementSupport.NONE;
}

/**
Expand All @@ -95,12 +94,12 @@ public String applyQuote(final String identifier) {

@Override
public boolean requiresCatalogQualifiedTableNames(final SqlGenerationContext context) {
return false;
return true;
}

@Override
public boolean requiresSchemaQualifiedTableNames(final SqlGenerationContext context) {
return true;
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,22 @@ void testGetAggregateFunctionCapabilities() {

@Test
void testSupportsJdbcCatalogs() {
assertThat(this.dialect.supportsJdbcCatalogs(), equalTo(SqlDialect.StructureElementSupport.NONE));
assertThat(this.dialect.supportsJdbcCatalogs(), equalTo(SqlDialect.StructureElementSupport.MULTIPLE));
}

@Test
void testSupportsJdbcSchemas() {
assertThat(this.dialect.supportsJdbcSchemas(), equalTo(SqlDialect.StructureElementSupport.MULTIPLE));
assertThat(this.dialect.supportsJdbcSchemas(), equalTo(SqlDialect.StructureElementSupport.NONE));
}

@Test
void testRequiresCatalogQualifiedTableNames() {
assertThat(this.dialect.requiresCatalogQualifiedTableNames(null), equalTo(false));
assertThat(this.dialect.requiresCatalogQualifiedTableNames(null), equalTo(true));
}

@Test
void testRequiresSchemaQualifiedTableNames() {
assertThat(this.dialect.requiresSchemaQualifiedTableNames(null), equalTo(true));
assertThat(this.dialect.requiresSchemaQualifiedTableNames(null), equalTo(false));
}

@Test
Expand Down Expand Up @@ -119,7 +119,7 @@ void testMetadataReaderClass() {
void testGetSupportedProperties() {
assertThat(this.dialect.getSupportedProperties(),
containsInAnyOrder(SQL_DIALECT_PROPERTY, CONNECTION_NAME_PROPERTY, CONNECTION_STRING_PROPERTY,
USERNAME_PROPERTY, PASSWORD_PROPERTY, SCHEMA_NAME_PROPERTY, TABLE_FILTER_PROPERTY,
USERNAME_PROPERTY, PASSWORD_PROPERTY, TABLE_FILTER_PROPERTY, CATALOG_NAME_PROPERTY,
EXCLUDED_CAPABILITIES_PROPERTY, DEBUG_ADDRESS_PROPERTY, LOG_LEVEL_PROPERTY));
}
}

0 comments on commit 09533ce

Please sign in to comment.