Coder Social home page Coder Social logo

Comments (3)

chenzl25 avatar chenzl25 commented on May 28, 2024

Could you please give an example to reproduce it?

from dbt-risingwave.

neverchanje avatar neverchanje commented on May 28, 2024
{%- set cols = adapter.get_columns_in_relation(source('public', 'shopify_orders')) -%}
WITH source AS (
    SELECT
        *
    FROM
        {{ source(
            'public',
            'shopify_orders'
        ) }}
)
SELECT
    {% for col in cols %}
        {% if col.name %}
            CAST(
                {{ col.name }} AS {{ col.data_type }}
            ) AS {{ col.name }}

            {% if not loop.last %},
            {% endif %}
        {% endif %}
    {% endfor %}
FROM
    source

Here is the example. First you'll need to define the source's schema in a yaml file. And even if the column type I used is varchar, get_columns_in_relation still returns varchar(0).

SELECT
    
        
            CAST(
                id AS character varying(0)
            ) AS id

            ,

The above is the compiled code. I've searched but found no alternative for get_columns_in_relation.

from dbt-risingwave.

fuyufjh avatar fuyufjh commented on May 28, 2024

What does postgres-dbt returns for varchar without length?

image

from dbt-risingwave.

Related Issues (19)

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.