Database requests within scripts

I want to place database requests within scripts. In other scripts I could find commands like Session.Source().GetCollection or Connection.SqlFormatter, but I could not find any documentation, how to use these commands. Is there any documentation and where can I find it?