generated from finos/software-project-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connection equality added for relational database connections - legen…
…d using equality key based checks (#2418) Tests added for athena, databricks, snowflake, bigquery and generic (cherry picked from commit 1039d48) Post processor comparison changed to look at sequence and type only. A future release will look to introduce an equality check function into a post processor which can be explicitly coded and used as it is impractical to add equality keys to all possible post processor hierarchies
- Loading branch information
Showing
25 changed files
with
587 additions
and
59 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...-xt-relationalStore-athena-pure/src/main/resources/core_relational_athena.definition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...c/main/resources/core_relational_athena/relational/connection/connectionEqualityTest.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2021 Goldman Sachs | ||
// | ||
// 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. | ||
|
||
import meta::relational::metamodel::execute::tests::*; | ||
import meta::external::store::relational::runtime::*; | ||
import meta::pure::runtime::*; | ||
import meta::relational::translation::*; | ||
import meta::pure::extension::*; | ||
import meta::relational::extension::*; | ||
import meta::relational::runtime::*; | ||
import meta::relational::tests::csv::*; | ||
import meta::relational::metamodel::execute::*; | ||
import meta::relational::metamodel::*; | ||
import meta::pure::mapping::*; | ||
|
||
function <<test.Test>> meta::relational::tests::connEquality::testConnectionEqualityAllSameAthena() : Boolean[1] | ||
{ | ||
let c1 = ^RelationalDatabaseConnection( | ||
|
||
type = DatabaseType.Athena, | ||
datasourceSpecification = ^meta::pure::alloy::connections::alloy::specification::AthenaDatasourceSpecification(awsRegion='awsR', s3OutputLocation='s3OL', databaseName='db'), | ||
authenticationStrategy = ^meta::pure::alloy::connections::alloy::authentication::ApiTokenAuthenticationStrategy(apiToken='token') | ||
); | ||
|
||
let c2 = ^RelationalDatabaseConnection( | ||
|
||
type = DatabaseType.Athena, | ||
datasourceSpecification = ^meta::pure::alloy::connections::alloy::specification::AthenaDatasourceSpecification(awsRegion='awsR', s3OutputLocation='s3OL', databaseName='db'), | ||
authenticationStrategy = ^meta::pure::alloy::connections::alloy::authentication::ApiTokenAuthenticationStrategy(apiToken='token') | ||
); | ||
|
||
assert(runRelationalRouterExtensionConnectionEquality($c1, $c2)); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...rc/test/java/org/finos/legend/pure/code/core/Test_Pure_Relational_ConnectionEquality.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2022 Goldman Sachs | ||
// | ||
// 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 org.finos.legend.pure.code.core; | ||
|
||
import junit.framework.TestSuite; | ||
import org.finos.legend.pure.m3.execution.test.PureTestBuilder; | ||
import org.finos.legend.pure.m3.execution.test.TestCollection; | ||
import org.finos.legend.pure.runtime.java.compiled.execution.CompiledExecutionSupport; | ||
import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; | ||
|
||
public class Test_Pure_Relational_ConnectionEquality | ||
{ | ||
public static TestSuite suite() | ||
{ | ||
String testPackage = "meta::relational::tests::connEquality"; | ||
CompiledExecutionSupport executionSupport = PureTestBuilderCompiled.getClassLoaderExecutionSupport(); | ||
return PureTestBuilderCompiled.buildSuite(TestCollection.collectTests(testPackage, executionSupport.getProcessorSupport(), ci -> PureTestBuilder.satisfiesConditions(ci, executionSupport.getProcessorSupport())), executionSupport); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...relationalStore-bigquery-pure/src/main/resources/core_relational_bigquery.definition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ources/core_relational_bigquery/relational/runtime/connection/connectionEqualityTest.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2021 Goldman Sachs | ||
// | ||
// 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. | ||
|
||
import meta::relational::metamodel::execute::tests::*; | ||
import meta::external::store::relational::runtime::*; | ||
import meta::pure::runtime::*; | ||
import meta::relational::translation::*; | ||
import meta::pure::extension::*; | ||
import meta::relational::extension::*; | ||
import meta::relational::runtime::*; | ||
import meta::relational::tests::csv::*; | ||
import meta::relational::metamodel::execute::*; | ||
import meta::relational::metamodel::*; | ||
import meta::pure::mapping::*; | ||
|
||
function <<test.Test>> meta::relational::tests::connEquality::testConnectionEqualityAllSameBigQuery() : Boolean[1] | ||
{ | ||
let c1 = ^RelationalDatabaseConnection( | ||
|
||
type = DatabaseType.Snowflake, | ||
datasourceSpecification = ^meta::pure::alloy::connections::alloy::specification::BigQueryDatasourceSpecification(projectId='project', defaultDataset='defDs', proxyHost='ph', proxyPort='8080'), | ||
authenticationStrategy = ^meta::pure::alloy::connections::alloy::authentication::ApiTokenAuthenticationStrategy(apiToken='token') | ||
); | ||
|
||
let c2 = ^RelationalDatabaseConnection( | ||
|
||
type = DatabaseType.Snowflake, | ||
datasourceSpecification = ^meta::pure::alloy::connections::alloy::specification::BigQueryDatasourceSpecification(projectId='project', defaultDataset='defDs', proxyHost='ph', proxyPort='8080'), | ||
authenticationStrategy = ^meta::pure::alloy::connections::alloy::authentication::ApiTokenAuthenticationStrategy(apiToken='token') | ||
); | ||
|
||
assert(runRelationalRouterExtensionConnectionEquality($c1, $c2)); | ||
|
||
} | ||
|
31 changes: 31 additions & 0 deletions
31
...rc/test/java/org/finos/legend/pure/code/core/Test_Pure_Relational_ConnectionEquality.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2022 Goldman Sachs | ||
// | ||
// 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 org.finos.legend.pure.code.core; | ||
|
||
import junit.framework.TestSuite; | ||
import org.finos.legend.pure.m3.execution.test.PureTestBuilder; | ||
import org.finos.legend.pure.m3.execution.test.TestCollection; | ||
import org.finos.legend.pure.runtime.java.compiled.execution.CompiledExecutionSupport; | ||
import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; | ||
|
||
public class Test_Pure_Relational_ConnectionEquality | ||
{ | ||
public static TestSuite suite() | ||
{ | ||
String testPackage = "meta::relational::tests::connEquality"; | ||
CompiledExecutionSupport executionSupport = PureTestBuilderCompiled.getClassLoaderExecutionSupport(); | ||
return PureTestBuilderCompiled.buildSuite(TestCollection.collectTests(testPackage, executionSupport.getProcessorSupport(), ci -> PureTestBuilder.satisfiesConditions(ci, executionSupport.getProcessorSupport())), executionSupport); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...tionalStore-databricks-pure/src/main/resources/core_relational_databricks.definition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name" : "core_relational_databricks", | ||
"pattern" : "(meta::relational::functions::sqlQueryToString::databricks|meta::relational::tests::sqlQueryToString::databricks|meta::relational::databricks::tests|meta::relational::tests::functions::sqlstring::databricks|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", | ||
"pattern" : "(meta::relational::functions::sqlQueryToString::databricks|meta::relational::tests::sqlQueryToString::databricks|meta::relational::tests::connEquality|meta::relational::databricks::tests|meta::relational::tests::functions::sqlstring::databricks|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", | ||
"dependencies" : ["platform", "platform_functions", "platform_store_relational", "platform_dsl_mapping", "core_functions", "core", "core_relational"] | ||
} |
47 changes: 47 additions & 0 deletions
47
...in/resources/core_relational_databricks/relational/connection/connectionEqualityTest.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2021 Goldman Sachs | ||
// | ||
// 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. | ||
|
||
import meta::relational::metamodel::execute::tests::*; | ||
import meta::external::store::relational::runtime::*; | ||
import meta::pure::runtime::*; | ||
import meta::relational::translation::*; | ||
import meta::pure::extension::*; | ||
import meta::relational::extension::*; | ||
import meta::relational::runtime::*; | ||
import meta::relational::tests::csv::*; | ||
import meta::relational::metamodel::execute::*; | ||
import meta::relational::metamodel::*; | ||
import meta::pure::mapping::*; | ||
|
||
function <<test.Test>> meta::relational::tests::connEquality::testConnectionEqualityAllSameDataBricks() : Boolean[1] | ||
{ | ||
let c1 = ^RelationalDatabaseConnection( | ||
|
||
type = DatabaseType.Databricks, | ||
datasourceSpecification = ^meta::pure::alloy::connections::alloy::specification::DatabricksDatasourceSpecification(hostname='host', port='8080', protocol='http', httpPath='http://path'), | ||
authenticationStrategy = ^meta::pure::alloy::connections::alloy::authentication::ApiTokenAuthenticationStrategy(apiToken='token') | ||
); | ||
|
||
let c2 = ^RelationalDatabaseConnection( | ||
|
||
type = DatabaseType.Databricks, | ||
datasourceSpecification = ^meta::pure::alloy::connections::alloy::specification::DatabricksDatasourceSpecification(hostname='host', port='8080', protocol='http', httpPath='http://path'), | ||
authenticationStrategy = ^meta::pure::alloy::connections::alloy::authentication::ApiTokenAuthenticationStrategy(apiToken='token') | ||
); | ||
|
||
assert(runRelationalRouterExtensionConnectionEquality($c1, $c2)); | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...rc/test/java/org/finos/legend/pure/code/core/Test_Pure_Relational_ConnectionEquality.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2022 Goldman Sachs | ||
// | ||
// 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 org.finos.legend.pure.code.core; | ||
|
||
import junit.framework.TestSuite; | ||
import org.finos.legend.pure.m3.execution.test.PureTestBuilder; | ||
import org.finos.legend.pure.m3.execution.test.TestCollection; | ||
import org.finos.legend.pure.runtime.java.compiled.execution.CompiledExecutionSupport; | ||
import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; | ||
|
||
public class Test_Pure_Relational_ConnectionEquality | ||
{ | ||
public static TestSuite suite() | ||
{ | ||
String testPackage = "meta::relational::tests::connEquality"; | ||
CompiledExecutionSupport executionSupport = PureTestBuilderCompiled.getClassLoaderExecutionSupport(); | ||
return PureTestBuilderCompiled.buildSuite(TestCollection.collectTests(testPackage, executionSupport.getProcessorSupport(), ci -> PureTestBuilder.satisfiesConditions(ci, executionSupport.getProcessorSupport())), executionSupport); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...tionalStore-__dbtype__-pure/src/main/resources/core_relational___dbtype__.definition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name" : "core_relational_${dbtype}", | ||
"pattern" : "(meta::relational::functions::sqlQueryToString::${dbType}|meta::relational::tests::sqlQueryToString::${dbType}|meta::pure::alloy::connections|meta::external::store::relational::runtime|meta::protocols::pure)(::.*)?", | ||
"pattern" : "(meta::relational::functions::sqlQueryToString::${dbType}|meta::relational::tests::sqlQueryToString::${dbType}|meta::pure::alloy::connections|meta::external::store::relational::runtime|meta::protocols::pure|meta::relational::tests::connEquality)(::.*)?", | ||
"dependencies" : ["platform", "platform_functions", "platform_store_relational", "core", "core_relational"] | ||
} |
47 changes: 47 additions & 0 deletions
47
...in/resources/core_relational___dbtype__/relational/connection/connectionEqualityTest.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2021 Goldman Sachs | ||
// | ||
// 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. | ||
|
||
import meta::relational::metamodel::execute::tests::*; | ||
import meta::external::store::relational::runtime::*; | ||
import meta::pure::runtime::*; | ||
import meta::relational::translation::*; | ||
import meta::pure::extension::*; | ||
import meta::relational::extension::*; | ||
import meta::relational::runtime::*; | ||
import meta::relational::tests::csv::*; | ||
import meta::relational::metamodel::execute::*; | ||
import meta::relational::metamodel::*; | ||
import meta::pure::mapping::*; | ||
|
||
|
||
function <<test.Test>> meta::relational::tests::connEquality::testConnectionEqualityAllSame__dbtype__() : Boolean[1] | ||
{ | ||
let c1 = ^RelationalDatabaseConnection( | ||
|
||
type = DatabaseType.__dbtype__, | ||
datasourceSpecification = ^meta::pure::alloy::connections::alloy::specification::__dbtype__DatasourceSpecification(), | ||
authenticationStrategy = ^meta::pure::alloy::connections::alloy::authentication::ApiTokenAuthenticationStrategy(apiToken='token') | ||
); | ||
|
||
let c2 = ^RelationalDatabaseConnection( | ||
|
||
type = DatabaseType.Snowflake, | ||
datasourceSpecification = ^meta::pure::alloy::connections::alloy::specification::BigQueryDatasourceSpecification(projectId='project', defaultDataset='defDs', proxyHost='ph', proxyPort='8080'), | ||
authenticationStrategy = ^meta::pure::alloy::connections::alloy::authentication::ApiTokenAuthenticationStrategy(apiToken='token') | ||
); | ||
|
||
assert(runRelationalRouterExtensionConnectionEquality($c1, $c2)); | ||
|
||
} | ||
|
31 changes: 31 additions & 0 deletions
31
...rc/test/java/org/finos/legend/pure/code/core/Test_Pure_Relational_ConnectionEquality.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2022 Goldman Sachs | ||
// | ||
// 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 org.finos.legend.pure.code.core; | ||
|
||
import junit.framework.TestSuite; | ||
import org.finos.legend.pure.m3.execution.test.PureTestBuilder; | ||
import org.finos.legend.pure.m3.execution.test.TestCollection; | ||
import org.finos.legend.pure.runtime.java.compiled.execution.CompiledExecutionSupport; | ||
import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; | ||
|
||
public class Test_Pure_Relational_ConnectionEquality | ||
{ | ||
public static TestSuite suite() | ||
{ | ||
String testPackage = "meta::relational::tests::connEquality"; | ||
CompiledExecutionSupport executionSupport = PureTestBuilderCompiled.getClassLoaderExecutionSupport(); | ||
return PureTestBuilderCompiled.buildSuite(TestCollection.collectTests(testPackage, executionSupport.getProcessorSupport(), ci -> PureTestBuilder.satisfiesConditions(ci, executionSupport.getProcessorSupport())), executionSupport); | ||
} | ||
} |
Oops, something went wrong.