▲ 2 r/aws

Best way to have Step Function with branching paths where failure does not interrupt all paths

I have a process that looks like this:

GetDataLambda -> ProcessDataLambdaA1 -> ProcessDataLambdaA2 -> ProcessDataLambdaB1 -> ProcessDataLambdaB2

Basically, GetDataLambda needs to run first to actually get the data I need. There are two separate sets of lambda functions to process it (A and B). Both rely on the data from the get function, but they're entirely independent of the other. So that's why I wanted to set it up where GetDataLambda runs first, but then there's a parallel step with one path doing the "Process A" functions and the other doing the "Process B" functions. However, with the way parallel stages work, if one branch fails, the entire thing fails.

What's the best way around this? If "Process A" fails, I still want the "Process B" branch to keep going, for example.

reddit.com
u/arib510 — 1 day ago
▲ 2 r/SQL

[MySQL] Unique constraint on multiple columns isn't working

I have a table that and I want to limit to ensure no duplicate rows get inserted. There's no primary key (because of how the data comes in), so I thought I could add a UNIQUE constraint including multiple columns. I have too many columns to include every single one, so I just included the ones I believed would be most likely to change.

The constraint I added looks like this:

ALTER TABLE table
ADD CONSTRAINT no_dupe_rows
UNIQUE(col1, col2, col3, col4)

However, when I test it, it still allows me to insert the same data multiple times, with statements such as the following:

INSERT INTO table(col1, col2, col3, col4)
VALUES (val1, val2, val3, val4)

I can run that multiple times and it adds a new row each time even with the UNIQUE constraint in place. What can I do to fix this?

reddit.com
u/arib510 — 1 month ago

I'm building a database with MySQL. I was wondering if it would be a waste to have a table with only the primary key and one additional column for the purpose of supplying a preset list of values for a column in another, bigger table. Here's an example of what I mean. Let's say I have the main table "people" and I want to associate them with a color. The colors should always be from a preset selection of red, blue, green, and yellow. Is it worth having a separate "colors" table with a colorid column and those 4 colors, and then the "people" table would simply have a "colorid" column as a foreign key? Or should I not bother with the second table and simply have "color" as a column for the main table?

My actual use case is a bit more involved than this but in principle is it worth doing things this way?

reddit.com
u/arib510 — 4 months ago