how to fetch userID from data table if user logged in currently? or How to fetch one of attributes in data table?
To get the currently logged-in user, you can just do
anvil.users.get_user()
This is a Row from the Users Data Table. The Users section of the reference docs might help.