The following example modifies the SQL query used to limit records retrieved to 10 records only if the user requesting the CSV file is not an admin.
function
tablename_csv(
$query
,
$memberInfo
,
$args
){
// return only the first 10 records for non-admin users.
if
(
$memberInfo
[
'group'
]!=
'Admins'
){
$query
.=
" limit 10"
;
}
return
$query
;
}