diff --git a/README.md b/README.md index 247305d6..e85761d0 100644 --- a/README.md +++ b/README.md @@ -28,18 +28,19 @@ Join our growing community of developers and data engineers on [RosettaDB Slack] The table below lists the currently supported databases and their respective translation capabilities. -| | **BigQuery** | **Snowflake** | **MySQL** | **Postgres** | **Kinetica** | **Google Cloud Spanner** | **SQL Server** | **DB2** | **Oracle** | **Redshift** | -|--------------------------|:--------------:|:-------------:|:------------:|:---------------:|:------------:|:------------------------:|:---------------:|:-----------:|:--------------:|:------------:| -| **BigQuery** | / | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| **Snowflake** | ✅ | / | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| **MySQL** | ✅ | ✅ | / | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| **Postgres** | ✅ | ✅ | ✅ | / | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| **Kinetica** | ✅ | ✅ | ✅ | ✅ | / | ✅ | ✅ | ✅ | ✅ | ✅ | -| **Google Cloud Spanner** | ✅ | ✅ | ✅ | ✅ | ✅ | / | ✅ | ✅ | ✅ | ✅ | -| **SQL Server** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | / | ✅ | ✅ | ✅ | -| **DB2** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | / | ✅ | ✅ | -| **Oracle** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | / | ✅ | -| **Redshift** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | / | +| | **BigQuery** | **Snowflake** | **MySQL** | **Postgres** | **Kinetica** | **Google Cloud Spanner** | **SQL Server** | **DB2** | **Oracle** | **Redshift** | **SAP IQ(Sybase)** | +|--------------------------|:--------------:|:-------------:|:------------:|:---------------:|:------------:|:------------------------:|:---------------:|:-----------:|:--------------:|:------------:|:------------------:| +| **BigQuery** | / | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | +| **Snowflake** | ✅ | / | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | +| **MySQL** | ✅ | ✅ | / | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | +| **Postgres** | ✅ | ✅ | ✅ | / | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | +| **Kinetica** | ✅ | ✅ | ✅ | ✅ | / | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | +| **Google Cloud Spanner** | ✅ | ✅ | ✅ | ✅ | ✅ | / | ✅ | ✅ | ✅ | ✅ | ❌ | +| **SQL Server** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | / | ✅ | ✅ | ✅ | ❌ | +| **DB2** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | / | ✅ | ✅ | ❌ | +| **Oracle** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | / | ✅ | ❌ | +| **Redshift** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | / | ❌ | +| **SAP IQ(Sybase)** | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | / | ## Getting Started diff --git a/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/column/SAPIQColumnsExtractor.java b/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/column/SAPIQColumnsExtractor.java new file mode 100644 index 00000000..f37306f5 --- /dev/null +++ b/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/column/SAPIQColumnsExtractor.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 AdaptiveScale + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.adataptivescale.rosetta.source.core.extractors.column; + +import com.adaptivescale.rosetta.common.TranslationMatrix; +import com.adaptivescale.rosetta.common.annotations.RosettaModule; +import com.adaptivescale.rosetta.common.models.Column; +import com.adaptivescale.rosetta.common.models.input.Connection; +import com.adaptivescale.rosetta.common.types.RosettaModuleTypes; + +import java.sql.ResultSet; +import java.sql.SQLException; + + +@RosettaModule( + name = "sapiq", + type = RosettaModuleTypes.COLUMN_EXTRACTOR +) +public class SAPIQColumnsExtractor extends ColumnsExtractor{ + public SAPIQColumnsExtractor(Connection connection) { + super(connection); + } + + @Override + protected void extract(ResultSet resultSet, Column column) throws SQLException { + column.setName(resultSet.getString("COLUMN_NAME")); + + String columnType = resultSet.getString("TYPE_NAME"); + if (columnType != null) { + column.setTypeName(TranslationMatrix.getInstance().findBySourceTypeAndSourceColumnType("sapiq", columnType)); + } + + String nullableStr = resultSet.getString("IS_NULLABLE"); + if (nullableStr != null && (nullableStr.equalsIgnoreCase("YES") || nullableStr.equalsIgnoreCase("NO"))) { + column.setNullable("YES".equalsIgnoreCase(nullableStr)); + } else { + column.setNullable(resultSet.getBoolean("IS_NULLABLE")); + } + + column.setColumnDisplaySize(resultSet.getInt("COLUMN_SIZE")); + column.setScale(resultSet.getInt("DECIMAL_DIGITS")); + column.setPrecision(resultSet.getInt("COLUMN_SIZE")); + } +} + diff --git a/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/table/SAPIQTablesExtractor.java b/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/table/SAPIQTablesExtractor.java new file mode 100644 index 00000000..15334b9c --- /dev/null +++ b/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/table/SAPIQTablesExtractor.java @@ -0,0 +1,29 @@ +/* + * Copyright 2022 AdaptiveScale + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.adataptivescale.rosetta.source.core.extractors.table; + +import com.adaptivescale.rosetta.common.annotations.RosettaModule; +import com.adaptivescale.rosetta.common.types.RosettaModuleTypes; + +@RosettaModule( + name = "sapiq", + type = RosettaModuleTypes.TABLE_EXTRACTOR +) +public class SAPIQTablesExtractor extends DefaultTablesExtractor{ + +} + diff --git a/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/view/SAPIQViewExtractor.java b/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/view/SAPIQViewExtractor.java new file mode 100644 index 00000000..03852924 --- /dev/null +++ b/source/src/main/java/com/adataptivescale/rosetta/source/core/extractors/view/SAPIQViewExtractor.java @@ -0,0 +1,29 @@ +/* + * Copyright 2022 AdaptiveScale + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.adataptivescale.rosetta.source.core.extractors.view; + +import com.adaptivescale.rosetta.common.annotations.RosettaModule; +import com.adaptivescale.rosetta.common.types.RosettaModuleTypes; + +@RosettaModule( + name = "sapiq", + type = RosettaModuleTypes.VIEW_EXTRACTOR +) +public class SAPIQViewExtractor extends DefaultViewExtractor{ + +} + diff --git a/translator/src/main/resources/translation_matrix/translation.csv b/translator/src/main/resources/translation_matrix/translation.csv index 6ecd1de7..7d23d0dc 100644 --- a/translator/src/main/resources/translation_matrix/translation.csv +++ b/translator/src/main/resources/translation_matrix/translation.csv @@ -2697,3 +2697,28 @@ 2883;;redshift;;varbyte;;spanner;;bytes 2884;;redshift;;intervaly2m;;spanner;;string 2885;;redshift;;intervald2s;;spanner;;string +2886;;sapiq;;varchar;;kinetica;;string +2887;;sapiq;;char;;kinetica;;string +2888;;sapiq;;long varchar;;kinetica;;string +2889;;sapiq;;int;;kinetica;;int +2890;;sapiq;;integer;;kinetica;;int +2891;;sapiq;;smallint;;kinetica;;int16 +2892;;sapiq;;bigint;;kinetica;;long +2893;;sapiq;;unsigned bigint;;kinetica;;ulong +2894;;sapiq;;unsigned int;;kinetica;;int +2895;;sapiq;;timestamp;;kinetica;;timestamp +2896;;sapiq;;date;;kinetica;;date +2897;;sapiq;;binary;;kinetica;;bytes +2898;;sapiq;;time;;kinetica;;time +2899;;sapiq;;tinyint;;kinetica;;int8 +2900;;sapiq;;bit;;kinetica;;int8 +2901;;sapiq;;decimal;;kinetica;;decimal +2902;;sapiq;;numeric;;kinetica;;decimal +2903;;sapiq;;double;;kinetica;;double +2904;;sapiq;;double precision;;kinetica;;double +2905;;sapiq;;real;;kinetica;;float +2906;;sapiq;;float;;kinetica;;float +2907;;sapiq;;varbinary;;kinetica;;bytes +2908;;sapiq;;long binary;;kinetica;;bytes +2909;;sapiq;;blob;;kinetica;;bytes +2910;;sapiq;;clob;;kinetica;;string