Giter Club home page Giter Club logo

Comments (3)

burkaygur avatar burkaygur commented on May 29, 2024 2

I like the naming, and I like option 3 for the arg names.

from dbt-fal.

chamini2 avatar chamini2 commented on May 29, 2024

As discussed in a meeting, let's do:

  • append: the default behaviour that writes data to source with no deduplication measures
  • upsert: based on a given column, do a typical UPSERT operation
    -- Postgres example
    INSERT INTO distributors (id_col, dname)
      VALUES (5, 'Gizmo Transglobal'), (6, 'Associated Computing, Inc')
      ON CONFLICT (id_col) DO UPDATE SET dname = EXCLUDED.dname;
    -- Note that the special excluded table is used to reference values originally proposed for insertion
  • overwrite: Delete the contents of the table on the source and rewrite it

Then, this would be passed in a mode argument

def write_to_source(
        self,
        data: pd.DataFrame,
        target_source_name: str,
        target_table_name: str,
        mode: dict[str, str],
        dtype: Any = None,
):

and mode can have the values like

mode={'type': 'append'}
mode={'type': 'upsert', 'column': 'id_col'}
mode={'type': 'overwrite'}

or... we could do:

mode='append'
mode={'type': 'upsert', 'column': 'id_col'}
mode='overwrite'

or... we could add a new optional argument which we read only for upsert mode:

mode='append'
mode='upsert', upsert_column='id_col'
mode='overwrite'

from dbt-fal.

chamini2 avatar chamini2 commented on May 29, 2024

We did overwrite in #224, but have not done upsert yet. For now upsert is for the user (download the dataframe, update it locally, overwrite it) to do, since doing it on our side is not trivial (many adapters to support) and want to maybe consider how to do it better.

If anyone needs upsert, open a ticket and we will consider re-prioritizing it.

from dbt-fal.

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.