Hey all, I'm extracting from postgres and loading ...
# troubleshooting
s
Hey all, I'm extracting from postgres and loading to Snowflake incrementally. I have state working when using a local file, i.e
Copy code
MELTANO_STATE_BACKEND_URI='file:///Users/myname/Code/meltano-poc/myporject/state/'
and that works But now I want to save the state in a postgres db (the same one I'm extracting from) in a table called
state
. I changed my variable to:
Copy code
MELTANO_STATE_BACKEND_URI='postgresql://<user>:<password?@localhost:5432/meltano_states'
When I run
meltano run tap-postgres target-snowflake --state-id=staging-sync --full-refresh
, it does not save the state When I run
meltano run tap-postgres target-snowflake
, I get the error:
Copy code
Run invocation could not be completed as block failed: Cannot start plugin tap-postgres: 'postgresql' is not a valid StateBackend
Not sure where to go from here. 2 questions: 1. Is it possible to save state in a postgres database? 2. If so, how do I configure my table in postgres to save the state? Any help would be greatly appreciated!
1
d
s
I'll check those out - definitely wasn't using them before and couldn't find those docs when searching. Thanks so much!
e
@Simon Schmitke what you need for Meltano to use postgres as the state backend is: • set
MELTANO_STATE_BACKEND_URI=systemdb
to use one of the supported system dbs as a state backend • set
MELTANO_DATABASE_URI=postgresql://<user>:<password?@localhost:5432/meltano_states
to use your postgres instance as the system database
d
@Edgar Ramírez (Arch.dev) is it bad if I set only
MELTANO_DATABASE_URI=postgresql+psycopg://
without
MELTANO_STATE_BACKEND_URI
? (it works fine)
e
Oh no,
systemdb
is the default value actually. So, if
MELTANO_STATE_BACKEND_URI
is not set, Meltano will use the system database.
🙏 2