Lesson 5 of 8 · Lab
Move a flow's files to Cloud and rerun it
Cloud keeps files where a flow on any device can reach them. Input reads a Cloud file and Output writes one, while Run local still runs the flow in your own browser.
This lesson runs in Strata, Oplema's browser app for data prep, rather than in this page, so you need a desktop browser. Make a free account here. Guests can use Cloud too, with 25 MB of files and 200 MB of projects, but guest data is deleted about 30 days after the guest session started. An account keeps your work, gives you 800 MB of files and lets you publish in a later lesson.
Your files for fictional Kramerica Bikes live on your laptop and the flows so far live in lesson pages. Noor, who'll rerun this each month, can reach neither. Nothing from the page labs carries over, so you rebuild a smaller flow, bikes per day only, from the three September files: kramerica-harbour-sep.csv, kramerica-station-road-sep.csv and kramerica-old-town-sep.csv.
Station Road's file also holds Old Town's week from when its till was down. What happens to Old Town's days without Unique?
September 14 to 20 count twice, 82 bikes too many. Unique on booking_id keeps one copy of each booking, as in Remove rows that appear in two files.
Rebuild the daily table from Cloud files
- Download the three files above. Open Strata and select Sign up for a free account, or Log in.
- Select Cloud at the top. Select New folder, type
Kramericaand press Enter. Select Upload and choose the three files. You should see "Uploaded 3 files to Kramerica." - Select Strata. From IO, drag Input onto the canvas. Under Source, choose Cloud, select Browse, open Kramerica, select
kramerica-harbour-sep.csvand select Choose file. Add an Input for each of the other two files.
Then build the rest of the flow from this brief, as you built month-end in Debug a flow that runs but gives the wrong total: each booking once, finished and dated hires only, bikes out per shop per day, Marit's fleet beside each day and a short_90 column that is 1 on a day when bikes out reach 90% of bikes_owned. The short-day rule from Add a what-if parameter to a dashboard is your model.
If you're stuck
- Wire the three Inputs into a Union, then a Cleanse with Trim Whitespace selected and a per-column override on
statuswith Modify Case set to Lower, then Unique onbooking_id. Leave the case of the other columns alone: loweringshoptoo would leave the fleet Join with nothing to match. - From Unique's Unique output, add DateTime with Column
hire_date, Text looks like set to EU date, Output as set to DATE and Output columnhire_on. Then add Filter:status IN ('completed', 'returned') AND hire_on IS NOT NULL. - On Filter's True output, add Summarize: group by
shopandhire_onand sumbikesasbikes_out. - Add a Manual Input with columns
shopandbikes_ownedand Marit's three rows: Harbour 34, Station Road 46, Old Town 16. The grid starts with two rows: hover its bottom edge and select + to add a third. Wire Summarize to a Join's upper left dot and the fleet to its lower left dot, withshopas the key on both sides. - On Join's Inner output, add Formula with a column
short_90: the short-day rule, with 90 in place ofvalue.
Then write the table to Cloud and save a version:
- Wire Formula to an Output. Set Destination to Cloud and choose the Kramerica folder under Cloud Folder. In Filename, select all (Ctrl+A or Cmd+A) and type
kramerica-daily. Wire Formula to a Vista Source too, and typekramerica_dailyover its Display name the same way. - Select Run local. Select Formula and choose Preview: All rows. In Cloud,
kramerica-daily.csvis now in Kramerica. - Open History on the right, type
Daily bikes out from Cloud filesin What changed? and select Save.
Check: Formula reads 86 rows × 5 columns and 1,717 bikes out, and Join's Left output is empty: every day found its shop.
What you should see
One row per shop per open day. Harbour has 649 bikes out, Station Road 724 and Old Town 344, the same as the daily table in Add a shop filter to a dashboard. short_90 is 1 on 13 days: Old Town's 9 and Harbour's 4.
What runs where
Run local reads the Cloud files into your browser and runs the flow there, so it costs nothing. Run server and Schedule start hosted runs in your region, which spend usage. This course doesn't use them.
Each Input remembers the one file it picked. Running again overwrites kramerica-daily.csv in place, but an upload with a name that's already in the folder is refused, so next month's exports arrive under their own names and someone picks them in the Inputs. The saved version is what Noor will open.
Your line for Marit: "The daily table now builds from files in Cloud, and once it's shared, Noor can rerun it."
See Files in Cloud, the Input reference and Saves. For later: Where data lives explains why a shared source beats a copy on one laptop.
Common Cloud file mistakes
- Building on files on your laptop. The flow runs for you and fails for everyone else. Inputs that read Cloud travel with the project.
Shared files in SQL and Excel
SELECT * FROM read_csv(
['kramerica-harbour-sep.csv', 'kramerica-station-road-sep.csv', 'kramerica-old-town-sep.csv'],
union_by_name = true);DuckDB reads several files into one table, as the three Inputs and Union do. In Excel, Power Query's From Folder stacks every file in a folder, which works only while everyone points at the same one.