Fetching 1k records from table using "Snowflake select snap"

I’m planning to fetch the data from a table using “Snowflake select snap” while putting the condition of getting 1k records ONLY in WHERE clause however it is not getting any results.

I can put the entire query in “Snowflake execute snap” as well but wanting to do with Snowflake Select as of now. Any help is highly appreciable.

Thanks!

@darshthakkar

You can use the “Limit rows” property to specify the number of rows to be returned by the query.

2 Likes

You should use LIMIT for limiting the output of records.

2 Likes

Does that mean, I would never be able to get 1k records from the Snowflake DB?
Today, the requirement is to fetch 1k records, tomorrow it may be 5k, 10k, so on and so forth.

I’m actually putting those IDs in the WHERE clause so it might exceed the character limit of 255 characters.

I tried limiting it but I want all those 1k records, am I doing the right thing by putting 1k IDs in the WHERE clause of Snowflake Select snap?

Still brand new to snapLogic so I’m sure there would be something where I’m making a mistake.

You have a particular set of IDs you want to process, and that set counts 1000 records? Or you just want the first 1000 from the table?

I’ve a specific set of 1000 IDs as of today, tomorrow it could be 5k, 0.5k or even 40k. Due to limited knowledge, I’m putting those IDs in the where clause of the query.

Are you executing the pipeline, or just validating?

Both validating and executing…

That’s strange. Can you show us the current setup of the snap?

Sure, below snaps for your reference:

There’s no need for the expression functionality (equal sign (=)) button to be on in both situations, unless you’re using some function later in the where clause. Other than that, I can see that you have a new line character ‘\n’ in the query itself, so you should replace those with new lines or space.

1 Like

Even if I remove the “=” decorator, the query doesn’t run. Moreover, regarding \n, there is none in the query but the error message still shows that → this is where I’m blown away.

I appreciate your detailed attention though.

If you are allowed to, send the query without IDs in the where clause. Make sure you use the Preformatted text option when pasting the query.

1 Like

How do I send IDs without where clause in the query? Is there any snap which will help me with the same?

Sorry, I didn’t explained myself correctly. I meant send the query here, without the ids.

1 Like

There you go:

SELECT
CREATED,
CREATED_BY,
FAQ_QUES_TEXT,
INTR_PUBLISH_FLG,
LAST_UPD,
LAST_UPD_BY,
MODIFICATION_NUM,
NAME,
PR_AUTHOR_ID,
PUBLISH_FLG,
RESOLUTION_TEXT,
ROW_ID,
STATUS_CD,
TYPE_CD,
X_PROD_FAMILY,
X_PROD_VER,
X_REGION,
X_RESOLUTION_TEXT,
X_SUB_AREA
FROM S_RESITEM

*** removed where clause ***

The query seems ok. What’s the situation when you turn off the expression support? What’s the output of the Select snap when you validate?

1 Like

Getting a different error this time:

Index out of bounds; I believe is because of those 1000 IDs. I can remove those 1k IDs and validate the error again.

Getting the same error even though reducing the IDs in where clause to 6:

Also the query has been limited to 10 records too.

image