Ejemplo n.º 1
0
        public override async Task CreateContainer(ExecutionContext executionContext, Guid providerDefinitionId, CreateContainerModel model)
        {
            try
            {
                var config = await base.GetAuthenticationDetails(executionContext, providerDefinitionId);

                var sql = BuildCreateContainerSql(model);

                _logger.LogDebug($"Snowflake Connector - Create Container - Generated query: {sql}");

                await _client.ExecuteCommandAsync(config, sql);
            }
            catch (Exception e)
            {
                var message = $"Could not create Container {model.Name} for Connector {providerDefinitionId}";
                _logger.LogError(e, message);
                //throw new CreateContainerException(message);
            }
        }
Ejemplo n.º 2
0
        public override async Task CreateContainer(ExecutionContext executionContext, Guid providerDefinitionId, CreateContainerModel model)
        {
            var config = await base.GetAuthenticationDetails(executionContext, providerDefinitionId);

            async Task CreateTable(string name, IEnumerable <ConnectionDataType> columns, string context)
            {
                var sql = BuildCreateContainerSql(name, columns);

                _logger.LogDebug("Sql Server Connector - Create Container[{Context}] - Generated query: {sql}", context, sql);

                try
                {
                    await _client.ExecuteCommandAsync(config, sql);
                }
                catch (Exception e)
                {
                    var message = $"Could not create Container {name} for Connector {providerDefinitionId}";
                    _logger.LogError(e, message);
                    throw new CreateContainerException(message);
                }
            }

            var tasks = new List <Task> {
                CreateTable(model.Name, model.DataTypes, "Data")
            };

            if (model.CreateEdgeTable)
            {
                tasks.Add(CreateTable(EdgeContainerHelper.GetName(model.Name), new List <ConnectionDataType>
                {
                    new ConnectionDataType {
                        Name = Sanitize("OriginEntityCode"), Type = VocabularyKeyDataType.Text
                    },
                    new ConnectionDataType {
                        Name = Sanitize("Code"), Type = VocabularyKeyDataType.Text
                    },
                }, "Edges"));
            }

            await Task.WhenAll(tasks);
        }