Did You Know? Change Bucket Mid-Script

Our Did You Know series brings some of Initial State’s amazing features to attention while giving tips and tricks on how to make the most of them.ChangeBucketsMidScript

Did you know that you can change which bucket your stream is sending events to in the middle of your Python script? Maybe you’re collecting a lot of information but want to organize it in two or more buckets. Or maybe you have events that are relevant to two different projects. You only need one script!

Simply insert streamer.set_bucket(bucket_name=”New Bucket”) right before when you want streamer.log statements to go to a different bucket.

An example of this would be something like

streamer = Streamer(bucket_name="Starting Bucket", access_key="YourAccessKey")

streamer.log("signal1", "starting")
streamer.set_bucket(bucket_name="New Bucket")
streamer.log("signal1", "starting")

Where signal1=starting would appear in both Starting Bucket and New Bucket.

You can read more about this in our support docs.

Don’t have an Initial State account?  Sign up for free here!

Leave a reply:

Your email address will not be published.

Site Footer