Your operations team requires a script for listing Cloud Bigtable, Memorystore, and Cloud SQL databases within a project. The script should accommodate user-defined filter expressions to narrow down the presented results. How should you retrieve the data?