Skip to main content

Preparing your Redshift warehouse for deployments

With Modelbit you can call your deployments from Redshift, adding their inferences to your warehouse's tables.

To enable this functionality, head to Settings, and add your Redshift warehouse. The wizard will walk you through the steps to configure the integration with Modelbit.

If you've already added a Redshift warehouse, click that warehouse to see its details page, then click Edit on the integration panel.

Efficiently querying Modelbit models from Redshift‚Äč

Redshift will efficiently query Modelbit in batch inside select statements. E.g. this statement is very efficient:

select public.ext_sampleModel_latest(myTable.myInput1, myTable.myInput2)
from myTable;

However, Redshift is inefficient when Modelbit models are called inside update statements. This statement is not efficient:

update myTable
set myPredictions = public.ext_sampleModel_latest(myTable.myInput1, myTable.myInput2);

Instead, fetch the predictions first in batch, and then assign them into your table, like so:

create temp table predictions_tbl (row_id int, predictions int);

insert into predictions_tbl (row_id, predictions)
select row_id, public.ext_sampleModel_latest(myInput1, myInput2) as predictions
from myTable;

update myTable
set predictions = predictions_tbl.predictions
from predictions_tbl
join myTable t on predictions_tbl.row_id = t.row_id;