Snowflake provides the QUERY_HISTORY_BY_USER() function to actually see the queries from any user. I'm using this command for querying:
select * from table (
<DATABASE>.<SCHEMA>.query_history_by_user(
USER_NAME=>'myUser',
END_TIME_RANGE_START=>to_timestamp_ltz('2021-11-24 06:00:00 -0100'),
END_TIME_RANGE_END=>to_timestamp_ltz('2021-11-24 17:00:00 -0100'),
RESULT_LIMIT=>100)
);
The problem is that this query does not yield any results. However, if I start the same query without the USER_NAME=>'myUser' statement - which is semantically the same, since the executing user is taken as a default - I do get the expected result. The result for a different user than mine (i.e. USER_NAME=>'differentUser') is also empty. All queries are executed as ACCOUNTADMIN, so rights are presumably not the problem.
So the question is: why does the query work without any user provided but does not work with a user specified?
Any help is really appreciated!