Giter VIP home page Giter VIP logo

Comments (26)

ahuang11 avatar ahuang11 commented on May 30, 2024

Do you have this wrapped in a flow? Also are you working in notebook?

Here's something you can try in notebook / script.

from prefect import flow
from prefect_gcp import GcpCredentials
from prefect_dbt.cli import DbtCliProfile
from prefect_dbt.cli.configs import BigQueryTargetConfigs


@flow
def test_flow():
    credentials = GcpCredentials()

    target_configs = BigQueryTargetConfigs(
        credentials=credentials,
        schema="schema",
        project="project",
    )
    dbt_cli_profile = DbtCliProfile(
        name="jaffle_shop",
        target="dev",
        target_configs=target_configs,
    )
    profile = dbt_cli_profile.get_profile()
    return profile

test_flow()

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

No the code is directly run within a kubernetes pod.

Locally it seems to work

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

Can you try to see if this branch potentially fixes the issue? I made the base class method also sync compatible, but unsure if it'll help.

https://github.com/PrefectHQ/prefect-dbt/pull/105/files

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

I have the same issue sadly :/

Finished in state Failed(message="Flow run encountered an exception. TypeError: cannot pickle 'coroutine' object\n", type=FAILED, result=TypeError("cannot pickle 'coroutine' object"))

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

I suspect it's due to PrefectHQ/prefect-gcp#80 not yet released. Could you try pulling prefect-gcp main?

e.g. in requirements.txt prefect-gcp @ git+https://github.com/PrefectHQ/prefect-gcp.git@main

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

Same issue with the prefect-gcp version 0.1.8+2.g28f72ba

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

To clarify: "No the code is directly run within a kubernetes pod."

Is your code wrapped in a flow?

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

Sure all the code is wrapped in a flow and triggered with prefect

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

Thanks for confirming and I appreciate your help testing! I made another commit on https://github.com/PrefectHQ/prefect-dbt/pull/105/files

Can you help me test that again? If this doesn't work, I think we might have to make it sync again.

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

@ahuang11 I'm so sorry It still doesn't work :( with same error

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

Thanks for testing. Can you provide a minimal reproducible example that we can try on our end?

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

hey @ahuang11
Actually I got this error even with the previous authentication method.

The 0.2.6 is broken for us because of the co routine error

It can be hard to reproduce the error because it happens only in a Kubernetes context (it works well locally)

  1. Package a docker image based on prefect 2.7.0-python3.10 with this version
    prefect-dbt = "0.2.6"
    dbt-bigquery = "1.3.0"
    prefect-gcp = "0.1.6"

  2. Add code to the docker image
    the code can be taken from the official prefect gcp example the error raises with any prefect_dbt.cli.commands import trigger_dbt_cli_command

  3. Create a storage & kubernetes block based on the previous docker image which will be used by the flow

  4. Start a flow in the prefect UI

If it's too hard for you to replicate this, we can plan a call or even let you use my mac remotely

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

Thanks for that; can you try #111 to see if this fixes the issue? I dropped the async.

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

@ahuang11 yes now it works perfectly with the last fix

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

It it possible to merge and release a 0.2.8 package ? :)

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

Yes I'll try to get the PR ready soon!

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

@lucienfregosibodyguard by any chance, are you loading a DbtCliProfile like shown in #114?

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

Here is my DbtCliProfile Definition

    def _get_credentials(self) -> GcpCredentials:
        return GcpCredentials()

    def _get_target_configs(self) -> BigQueryTargetConfigs:
        return BigQueryTargetConfigs(
            schema=self.dataset_name, project=self.gcp_project, credentials=self._get_credentials()
        )

    def _get_dbt_cli_profile(self) -> DbtCliProfile:
        return DbtCliProfile(
            name=self.dbt_folder_name, target=self.environment, target_configs=self._get_target_configs()
        )

let me know if it's not the up to date version to load DbtCliProfile

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

Okay so you don't use .save or .load?

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

No I can try with save and load

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

It seems better actually i don't have the coroutine error, it starts the DBT command and I got this

�[0m13:50:46  Encountered an error while reading profiles:
�[0m13:50:46    ERROR: Runtime Error
  Credentials in profile "dbt_models", target "" invalid: 'method' is a required property

Which is a "normal" error that should be solved in your PR

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

Hi @ahuang11 could you release a new tag to easily test this and update my code ?

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

Actually this isn't fixed yet. Will try to get a new release soon...

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

@ahuang11 could we make a new tag with the last fix ?

from prefect-dbt.

ahuang11 avatar ahuang11 commented on May 30, 2024

Done!

from prefect-dbt.

lucienfregosibodyguard avatar lucienfregosibodyguard commented on May 30, 2024

Thaaaaaaaks it works like a charm awesome

from prefect-dbt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.