Skip to content

Commit

Permalink
Enable artifact generation (#2414)
Browse files Browse the repository at this point in the history
* rename method

* Function activation cleanup

* rollback file changes

* Change spark keywords

* Change spark keywords

* Fix test

* Add Primitive Type to Open APi Generator

* Add byte

* Enable Artifact generation

* move artifact generator to new module
  • Loading branch information
Yasirmod17 authored Oct 30, 2023
1 parent 4d620e4 commit 5437582
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-snowflakeApp-api</artifactId>
<artifactId>legend-engine-xt-snowflakeApp-generator</artifactId>
</dependency>
<!-- Snowflake App -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
import org.finos.legend.engine.language.pure.grammar.to.DatabricksGrammarComposerExtension;
import org.finos.legend.engine.language.pure.grammar.to.extension.PureGrammarComposerExtension;
import org.finos.legend.engine.language.snowflakeApp.compiler.toPureGraph.SnowflakeAppCompilerExtension;
import org.finos.legend.engine.language.snowflakeApp.deployment.SnowflakeAppArtifactGenerationExtension;
import org.finos.legend.engine.language.snowflakeApp.generator.SnowflakeAppArtifactGenerationExtension;
import org.finos.legend.engine.language.snowflakeApp.grammar.from.SnowflakeAppGrammarParserExtension;
import org.finos.legend.engine.language.snowflakeApp.grammar.to.SnowflakeAppGrammarComposer;
import org.finos.legend.engine.language.sql.grammar.integration.SQLGrammarParserExtension;
Expand Down
4 changes: 4 additions & 0 deletions legend-engine-config/legend-engine-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-snowflakeApp-api</artifactId>
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-snowflakeApp-generator</artifactId>
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-hostedService-compiler</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
import org.finos.legend.engine.language.pure.modelManager.sdlc.SDLCLoader;
import org.finos.legend.engine.language.pure.relational.api.relationalElement.RelationalElementAPI;
import org.finos.legend.engine.language.snowflakeApp.api.SnowflakeAppService;
import org.finos.legend.engine.language.snowflakeApp.deployment.SnowflakeAppDeploymentConfiguration;
import org.finos.legend.engine.language.snowflakeApp.generator.SnowflakeAppDeploymentConfiguration;
import org.finos.legend.engine.plan.execution.PlanExecutor;
import org.finos.legend.engine.plan.execution.api.ExecutePlanLegacy;
import org.finos.legend.engine.plan.execution.api.ExecutePlanStrategic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@

<dependencies>
<!-- Pure -->
<dependency>
<groupId>org.finos.legend.pure</groupId>
<artifactId>legend-pure-m3-core</artifactId>
</dependency>
<!-- Pure -->

<!-- ENGINE -->
Expand Down Expand Up @@ -60,10 +56,6 @@
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-relationalStore-executionPlan</artifactId>
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-executionPlan-generation</artifactId>
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-shared-core</artifactId>
Expand All @@ -80,10 +72,6 @@
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-functionActivator-api</artifactId>
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-relationalStore-pure</artifactId>
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-relationalStore-protocol</artifactId>
Expand All @@ -92,11 +80,6 @@
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-executionPlan-execution</artifactId>
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-pure-platform-java</artifactId>
</dependency>

<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-snowflakeApp-pure</artifactId>
Expand All @@ -107,13 +90,7 @@
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-snowflakeApp-compiler</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-xt-snowflakeApp-grammar</artifactId>
<scope>runtime</scope>
<artifactId>legend-engine-xt-snowflakeApp-generator</artifactId>
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
Expand Down Expand Up @@ -188,10 +165,6 @@
<artifactId>jersey-common</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.finos.legend.engine</groupId>
<artifactId>legend-engine-language-pure-dsl-generation</artifactId>
</dependency>
<!-- TEST -->
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import org.finos.legend.engine.functionActivator.service.FunctionActivatorError;
import org.finos.legend.engine.functionActivator.service.FunctionActivatorService;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel;
import org.finos.legend.engine.language.snowflakeApp.deployment.SnowflakeAppArtifact;
import org.finos.legend.engine.language.snowflakeApp.deployment.SnowflakeAppContent;
import org.finos.legend.engine.language.snowflakeApp.deployment.SnowflakeAppDeploymentConfiguration;
import org.finos.legend.engine.language.snowflakeApp.deployment.SnowflakeAppGenerator;
import org.finos.legend.engine.language.snowflakeApp.deployment.SnowflakeDeploymentManager;
import org.finos.legend.engine.language.snowflakeApp.generator.SnowflakeAppArtifact;
import org.finos.legend.engine.language.snowflakeApp.deployment.SnowflakeAppDeploymentManager;
import org.finos.legend.engine.language.snowflakeApp.deployment.SnowflakeDeploymentResult;
import org.finos.legend.engine.language.snowflakeApp.generator.SnowflakeAppContent;
import org.finos.legend.engine.language.snowflakeApp.generator.SnowflakeAppDeploymentConfiguration;
import org.finos.legend.engine.language.snowflakeApp.generator.SnowflakeAppGenerator;
import org.finos.legend.engine.plan.execution.PlanExecutor;
import org.finos.legend.engine.plan.execution.stores.relational.config.TemporaryTestDbConfiguration;
import org.finos.legend.engine.plan.execution.stores.relational.connection.manager.ConnectionManagerSelector;
Expand All @@ -39,32 +39,31 @@
import org.finos.legend.pure.generated.Root_meta_external_function_activator_FunctionActivator;
import org.finos.legend.pure.generated.Root_meta_external_function_activator_snowflakeApp_SnowflakeApp;
import org.finos.legend.pure.generated.Root_meta_pure_extension_Extension;
import org.pac4j.core.profile.CommonProfile;

import java.util.List;

public class SnowflakeAppService implements FunctionActivatorService<Root_meta_external_function_activator_snowflakeApp_SnowflakeApp, SnowflakeAppDeploymentConfiguration, SnowflakeDeploymentResult>
{
private ConnectionManagerSelector connectionManager;
private SnowflakeDeploymentManager snowflakeDeploymentManager;
private SnowflakeAppDeploymentManager snowflakeDeploymentManager;

public SnowflakeAppService()
{
TemporaryTestDbConfiguration conf = new TemporaryTestDbConfiguration();
conf.port = Integer.parseInt(System.getProperty("h2ServerPort", "1234"));
this.connectionManager = new ConnectionManagerSelector(conf, FastList.newList());
this.snowflakeDeploymentManager = new SnowflakeDeploymentManager(new SnowflakeAppDeploymentTool(connectionManager));
this.snowflakeDeploymentManager = new SnowflakeAppDeploymentManager(new SnowflakeAppDeploymentTool(connectionManager));
}

public SnowflakeAppService(ConnectionManagerSelector connectionManager)
{
this.connectionManager = connectionManager;
this.snowflakeDeploymentManager = new SnowflakeDeploymentManager(new SnowflakeAppDeploymentTool(connectionManager));
this.snowflakeDeploymentManager = new SnowflakeAppDeploymentManager(new SnowflakeAppDeploymentTool(connectionManager));
}

public SnowflakeAppService(PlanExecutor executor)
{
this.snowflakeDeploymentManager = new SnowflakeDeploymentManager(executor);
this.snowflakeDeploymentManager = new SnowflakeAppDeploymentManager(executor);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
import org.finos.legend.engine.functionActivator.deployment.DeploymentManager;
import org.finos.legend.engine.functionActivator.deployment.FunctionActivatorArtifact;
import org.finos.legend.engine.language.snowflakeApp.api.SnowflakeAppDeploymentTool;
import org.finos.legend.engine.language.snowflakeApp.generator.SnowflakeAppArtifact;
import org.finos.legend.engine.language.snowflakeApp.generator.SnowflakeAppDeploymentConfiguration;
import org.finos.legend.engine.language.snowflakeApp.generator.SnowflakeAppContent;
import org.finos.legend.engine.plan.execution.PlanExecutor;
import org.finos.legend.engine.plan.execution.stores.relational.connection.manager.ConnectionManagerSelector;
import org.finos.legend.engine.plan.execution.stores.relational.plugin.RelationalStoreExecutor;
import org.finos.legend.engine.plan.execution.stores.relational.plugin.RelationalStoreState;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseConnection;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.RelationalDatabaseConnection;
import org.finos.legend.engine.language.snowflakeApp.deployment.SnowflakeAppDeploymentConfiguration;
import org.finos.legend.engine.shared.core.identity.Identity;
import org.finos.legend.pure.generated.Root_meta_pure_alloy_connections_alloy_authentication_SnowflakePublicAuthenticationStrategy;
import org.finos.legend.pure.generated.Root_meta_pure_alloy_connections_alloy_specification_SnowflakeDatasourceSpecification;
Expand All @@ -42,22 +44,22 @@
import java.util.Map;


public class SnowflakeDeploymentManager implements DeploymentManager<SnowflakeAppArtifact, SnowflakeDeploymentResult, SnowflakeAppDeploymentConfiguration>
public class SnowflakeAppDeploymentManager implements DeploymentManager<SnowflakeAppArtifact, SnowflakeDeploymentResult, SnowflakeAppDeploymentConfiguration>
{
private static final Logger LOGGER = LoggerFactory.getLogger(SnowflakeDeploymentManager.class);
private static final Logger LOGGER = LoggerFactory.getLogger(SnowflakeAppDeploymentManager.class);

private SnowflakeAppDeploymentTool snowflakeAppDeploymentTool;
private PlanExecutor planExecutor;
private ConnectionManagerSelector connectionManager;
private static final String deploymentSchema = "LEGEND_NATIVE_APPS";
private static final String deploymentTable = "APP_METADATA";

public SnowflakeDeploymentManager(SnowflakeAppDeploymentTool deploymentTool)
public SnowflakeAppDeploymentManager(SnowflakeAppDeploymentTool deploymentTool)
{
this.snowflakeAppDeploymentTool = deploymentTool;
}

public SnowflakeDeploymentManager(PlanExecutor planExecutor)
public SnowflakeAppDeploymentManager(PlanExecutor planExecutor)
{
this.planExecutor = planExecutor;
connectionManager = ((RelationalStoreState)planExecutor.getExtraExecutors().select(c -> c instanceof RelationalStoreExecutor).getFirst().getStoreState()).getRelationalExecutor().getConnectionManager();
Expand Down

This file was deleted.

Loading

0 comments on commit 5437582

Please sign in to comment.