Anyone with experience adding <https://github.com/...
# plugins-dbt
k
Anyone with experience adding https://github.com/fal-ai/fal to their meltano project as a custom utility?
t
I’d be curious to see how it goes for folks. with the
meltano run
command you’d be able to run arbitrary python scripts after dbt generally. so there’s definitely some overlap in functionality.
j
@taylor is there anywhere in the docs that docs about how to run arbitrary python with
meltano run
? I'm looking for an example. Thx!!
All i see in the docs is
Copy code
meltano run tap-gitlab target-postgres simple-job
which is cool! but unclear how to define said simple job in my meltano.yml file
t
but even looking at that, it’s not a great example
@pat_nadolny do we have a good example in Squared of just running a random python script?
p
I dont have one in squared but I posted this a while ago. The example uses bash but it should work all the same with a python script too https://meltano.slack.com/archives/C01TCRBBJD7/p1685628417315209?thread_ts=1685613727.607619&amp;cid=C01TCRBBJD7
j
oh sweet will try this
thank you @pat_nadolny!
ok i can get it to run with
meltano invoke custom_util:command
i'm cheating and hooking it into another util but the syntax works.
is the job syntax for this
- invoke custom_util:command
p
I think you just need the plugin + command that comes after your
meltano run
like
meltano run custom_util:command
similar to
meltano run tap-x target-y dbt-postgres:run
j
ah ok. i guess i will just add it as a shim to dbt for now.
t
add it as a shim to dbt for now.
I don’t think it needs to be a shim for dbt specifically. you can do
meltano run <tap> <target> custom_util:command
or even just
meltano run custom_util:command
j
well alternatively i have to make a custom util, right? that seems harder?
t
maybe slightly. I’m sure we can bang it out real quick if you want to hop on a call cc @pat_nadolny 😄
p
can you share more about the use case? Yeah I'm understanding shim as a command off of the dbt plugin so you'd run it like
meltano run dbt-snowflake:my_custom_py_script
. Heres an example:
Copy code
plugins:
  utilities:
  - name: dbt-snowflake
    variant: dbt-labs
    pip_url: dbt-core~=1.3.0 dbt-snowflake~=1.3.0 git+<https://github.com/meltano/dbt-ext.git@c6a30cac299184bae9424ccf9db8f41b30b27314>
    commands:
      my_python_script:
        executable: python
        args: transform/my_python_script.py
where
Copy code
transform/my_python_script.py
contains
print("Hello!!!")
. I run
meltano run dbt-snowflake:my_python_script
and I get
Copy code
(meltano) Patricks-MBP:data pnadolny$ meltano run dbt-snowflake:my_python_script
2023-07-13T15:14:37.699304Z [info     ] Environment 'userdev' is active
2023-07-13T15:14:38.442054Z [info     ] Hello!!!                       cmd_type=command name=dbt-snowflake stdio=stderr
2023-07-13T15:14:38.445345Z [info     ] Block run completed.           block_type=InvokerCommand err=None set_number=0 success=True
But yes the alternative is to build a custom utility, heres an example that I built custom for squared https://github.com/meltano/squared/tree/main/data/utilities/snowflake-cloner. It was useful to use a standalone utility in this case because the code was more complex and I needed to install dependencies
j
yes i probably need to consider the same
my use case is writing parquet files to azure blob storage