https://kedro.org/ logo
#questions
Title
# questions
a

Afiq Johari

02/29/2024, 1:02 PM
Hi, https://docs.kedro.org/en/stable/data/data_catalog_yaml_examples.html#id15 I'd like to save a pandas dataframe output to a sql table. I'm familiar with reading data from sql table, but not so much on writing to a sql table. Namely, how do I specify the arguments to • append to the existing table • if not append, if I want to replace the rows in the existing table based on some primary keys (date, userID)
j

Juan Luis

02/29/2024, 1:04 PM
hi @Afiq Johari! you could define the output of your node as a
pandas.SQLTableDataset
https://docs.kedro.org/projects/kedro-datasets/en/kedro-datasets-2.1.0/api/kedro_datasets.pandas.SQLTableDataset.html and specify
Copy code
save_args:
    if_exists: append
would that work for you?
K 1
a

Afiq Johari

02/29/2024, 1:16 PM
@Juan Luis this is perfect! thanks
💯 2