Hello, I'm trying develop a tap for a simple api b...
# singer-tap-development
h
Hello, I'm trying develop a tap for a simple api before going to more advanced cases, i just call it and it gives json info. I tested the tap alone and it works fine and also with target-jsonl. But when using it with target-postgres i got the error in the file. Does anybody have an idea on what's causing this ? Thank you
e
Hi @hicham_rahj! It looks like the target schema
tap_catfacts
doesn't exist in the postgres db. Most
target-postgres
variants support some way of creating it for you based on a setting. What variant are you using?
h
i'm using the deafult one "datamill-co"
This should be done by the target or do i have to change something in the implementation of my tap ?
e
The target should be able to handle it. The
datamill-co
variant supports a
before_run_sql
setting that runs arbitrary SQL before it starts loading so you can leverage it to create the schema:
Copy code
loaders:
  - name: target-postgres
    variant: datamill-co
    pip_url: singer-target-postgres
    config:
      before_run_sql: "CREATE SCHEMA IF NOT EXISTS ${MELTANO_EXTRACT__LOAD_SCHEMA};" # <--- THIS
You can learn more about the
load_schema
extra here: https://www.meltano.com/docs/plugins.html#load-schema-extra
h
Thank you I will check that today