Exemplo n.º 1
0
    public void CreateOrReplaceTable()
    {
        //Arrange
        var creationMetadata = GetEntityCreationMetadata(topicName: "my_movie");

        //Act
        string statement = StatementGenerator.CreateOrReplaceTable <CreateEntityTests.MyMovie>(creationMetadata);

        //Assert
        statement.Should().Be($"CREATE OR REPLACE TABLE{GetExpectedClauses(isTable: true)}");
    }
Exemplo n.º 2
0
    /// <summary>
    /// Create a new table or replace an existing one with the specified columns and properties.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="creationMetadata">Table properties, specify details about your table by using the WITH clause.</param>
    /// <param name="cancellationToken">Optional cancellation token to cancel the operation</param>
    /// <returns>Http response object.</returns>
    public Task <HttpResponseMessage> CreateOrReplaceTableAsync <T>(EntityCreationMetadata creationMetadata, CancellationToken cancellationToken = default)
    {
        if (creationMetadata == null)
        {
            throw new ArgumentNullException(nameof(creationMetadata));
        }

        var ksql = StatementGenerator.CreateOrReplaceTable <T>(creationMetadata);

        return(ExecuteAsync <T>(ksql, cancellationToken));
    }