Recovering User Query Information
How to View SQL Queries by a Specific User in Kleene App
If you need to view all SQL queries executed by a specific user within the Kleene app, follow these steps:
Confidentiality Warning
Please handle these requests with confidentiality. Ensure that only authorized personnel are involved in accessing and sharing this information and that the circumstances necessitate this type of action.
Asking Kleene to support a request of this nature will require sign off from your designated Kleene Account Admin provided in writing to your CS manager.
Option 1: Taking over the User account
The standard way to retrieve this information is by changing the password for the user and logging in as them. This method allows you to access the app's internal logs, which retain a record of all queries. However, if the user account has been deleted, this method will not be possible.
Step 1 - Resetting a user password
Located in the App Settings accessible by Admins, please find detailed instructions here:
https://docs.kleene.ai/docs/resetting-a-user-password
Step 2 - Accessing the query history
Located in the SQL console please find detailed instructions here:
https://docs.kleene.ai/docs/sql-console#history
Option 2: Using Query History in Your Data Warehouse
Where a user has been deleted from Kleene then you can default back to internal query histories in your warehouse. This varies by Warehouse and may be impacted by retention history periods. Where you have tied the user in question to specific warehouse query credentials then you may search by the user name or identifier but if the user was running queries using the Kleene app's general user then you need to search for ELTUSER and attempt to filter out the queries that user made based on other information about the time of day or type of query that user was running.
Snowflake
Redshift
BigQuery
Use the INFORMATION_SCHEMA.JOBS view, which contains metadata about all jobs, including queries.
SELECT * FROM project-id.region.INFORMATION_SCHEMA.JOBS WHERE user_email = 'specific_user_email' AND creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY) AND job_type = 'QUERY';
Updated 5 months ago