Giter Site home page Giter Site logo

Base Classes about dbt-artifacts-parser HOT 5 CLOSED

yu-iskw avatar yu-iskw commented on August 15, 2024
Base Classes

from dbt-artifacts-parser.

Comments (5)

yu-iskw avatar yu-iskw commented on August 15, 2024

Can you elaborate on that? I would like to know use cases with base classes of each artifacts respectibly.

In reality, generated classes for dbt artifacts don't directly inherit BaseModel so that we can implement something common among the classes of artifacts. However, I haven't seen any cases for that.

from dbt-artifacts-parser.

judahrand avatar judahrand commented on August 15, 2024

My use case is that I'm looking to build a tool which exposes the artifacts via a GraphQL API (https://github.com/judahrand/dbt-metadata-api). My first pass is trying to replicate the dbt Metadata API, though I'm not sure this is the best approach...

During development it is handy to hand type hints sort themselves out so that one gets autocomplete on them. For now I've just defined my own Union[ManifestV5, ManifestV6, ManifestV7] type and used that. This might even be the best approach... However, I also wonder if it would be possible to define a BaseManifest which is an abstract class which defines the common functionality between all the other classes?

from dbt-artifacts-parser.

yu-iskw avatar yu-iskw commented on August 15, 2024

@judahrand Thank you for the explanation. I see your point.

I'm not sure whether or not that works by using something like BaseManifest. As you know, we take advantage of datamodel-codegen commands in the datamodel-code-generator module to generate pydantic-based classes. Even a classe to a nested field inherit a specified base class. Since we pass the BaseParserClass class to datamodel-codegen commands in our case, all nested fields inherit the class. I am worried about type hinting gets confused due to a lot of inherited different classes.

If you are sure it wold work to create abstract classes by artifact type, I don't mind to refactor the code generation.

from dbt-artifacts-parser.

judahrand avatar judahrand commented on August 15, 2024

Unfortunately, at the moment I've moved away from using this package and instead am using dbt-core to parse the artifacts so I don't think I'll have much time to look into this.

from dbt-artifacts-parser.

yu-iskw avatar yu-iskw commented on August 15, 2024

Alright. Let's close the issue.

from dbt-artifacts-parser.

Related Issues (12)

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.