@@ -87,7 +87,7 @@ func (actor RedshiftDataActions) ListDatabases(ctx context.Context, clusterId st
8787// snippet-start:[gov2.redshift.CreateTable]
8888
8989// CreateTable creates a table named <tableName> in the <databaseName> database with the given arguments.
90- func (actor RedshiftDataActions ) CreateTable (ctx context.Context , clusterId string , databaseName string , tableName string , userName string , args []string ) error {
90+ func (actor RedshiftDataActions ) CreateTable (ctx context.Context , clusterId string , databaseName string , tableName string , userName string , pauser demotools. IPausable , args []string ) ( * redshiftdata. ExecuteStatementOutput , error ) {
9191 sql := "CREATE TABLE " + tableName + " (" +
9292 "id bigint identity(1, 1), " +
9393 "PRIMARY KEY (id)"
@@ -108,11 +108,25 @@ func (actor RedshiftDataActions) CreateTable(ctx context.Context, clusterId stri
108108 log .Printf ("Could not connect to the database." )
109109 } else if err != nil {
110110 log .Printf ("Failed to create table: %v\n " , err )
111- return err
111+ return nil , err
112+ }
113+
114+ describeStatementInput := & redshiftdata.DescribeStatementInput {Id : output .Id }
115+ query := RedshiftQuery {
116+ Context : ctx ,
117+ Input : * describeStatementInput ,
118+ Result : output ,
112119 }
113120
121+ err = actor .WaitForQueryStatus (query , pauser , true )
122+ if err != nil {
123+ log .Printf ("Failed to execute query: %v\n " , err )
124+ panic (err )
125+ }
126+ log .Printf ("Successfully executed query\n " )
127+
114128 log .Println ("Table created:" , * output .Id )
115- return nil
129+ return output , nil
116130}
117131
118132// snippet-end:[gov2.redshift.CreateTable]
0 commit comments