I want to read a parquet file with only certain columns and certain rows to formhandler in Gramex.
Asked
Active
Viewed 30 times
1
-
Can you please explain the use-case a bit in detail ? – Vinay Ranjan Jun 15 '21 at 06:27
1 Answers
0
Suppose you have city.parquet
, and you want to:
- filter rows where
country
isJapan
. - filter columns
lat
andlong
,
APPROACH #1 - Client-side: Use this configuration:
url:
data:
pattern: /data
handler: FormHandler
kwargs:
url: file.parquet
Now use the URL /data?country=Japan&_c=lat&_c=long
. This will filter by the required rows and columns.
APPROACH #2 - Server side: Use this configuration
url:
data:
pattern: /data
handler: FormHandler
kwargs:
url: file.parquet
function: data[data.country == 'Japan'][['lat', 'long']]
Now the URL /data
returns only the required rows and columns.
When to use which approach:
If you want the user or the application to control the rows and columns, use the client-side approach.
If you want to securely share only the required data, use the server-side approach.

S Anand
- 11,364
- 2
- 28
- 23