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

Gilad Rubin

02/01/2024, 11:57 AM
Hey all, I want to use SQL queries in my project, but I don't like how long queries affect the readability of the catalog file. Is there a way to save separate .sql files into a "queries" folder and read them in the catalog? e.g.: my_table: type: pandas.SQLQueryDataset sql: queries/path_to_query.sql credentials: cred
d

datajoely

02/01/2024, 11:59 AM
there is!
filepath
is the attribute you’re looking for
K 2
we should really have an example in the YAML ontop, but it is in the signature
👍🏼 1
n

Nok Lam Chan

02/01/2024, 12:55 PM
@Gilad Rubin Was it hard to discover this argument exists? I wonder how we can make this more obvious.
I think it's also time to re-shuffle the order of the argument, since we introduced position-only keyword-only arguments. > *_class_kedro_datasets.pandas.SQLQueryDataset(sql=None, credentials=None, _load_args=None_, _fs_args=None_, filepath=None, _execution_options=None_, metadata=None)[source]* I'd push down all those fs_args and bubble the dataset-specific argument up
g

Gilad Rubin

02/01/2024, 12:58 PM
Oh! yes, that's what I was looking for. I just searched "sql" in the kedro documentation and had multiple results... I went over the first ones and decided to write a question here. Perhaps the search function should be "smarter"
👍🏼 1
n

Nok Lam Chan

02/01/2024, 1:00 PM
Thanks! We are playing around with the weighting for the ranking recently, it's tricky to get it right but we will take this feedback, thank you.