Is it possible to generate a state for running `me...
# getting-started
d
Is it possible to generate a state for running
meltano run
?
p
but I dont know of a way to generate the state content without using one that previously exists
Like I'd probably do a get/manually edit/set workflow
d
@pat_nadolny Thank you! In this case I'll leave sync as it is, as you said, at the end of the run Meltano will write the final state at the db
a
To solve this issue, I wrote a little python script to generate initial state from scratch — something very useful when you have tables with pre-existing data, and you’d rather not do a full refresh. It makes a lot of assumptions (e.g., it assumes you know the state_id or how the state_id is going to be generated), and is somewhat tailored to my own use case (i.e., I only have Snowflake as a target, which made it easier to hardcode certain parts), but it worked well enough to get me up and running from a pre-existing state. Basically the script generates the JSON automatically, so it skips the
meltano state get <state_id>
and the manually setting parts that @pat_nadolny mentioned, but you still need to set the state automatically with
meltano state set
Here’s a gist