If you have multiple copies of PDTs based on the same view in your scratch schema, there could be a couple reasons:
Changing the SQL of a derived table in developer mode and querying it builds a new copy of the table.
This is only relevant when you change the SQL of the PDT, or the SQL in your dev mode is different than in production mode. Dev mode versions of tables are built when that PDT is queried, and last for 24 hours. This is equivalent to the dev mode table using
persist_for: 24 hours
.
Prior to Looker 3.30 separate copies of a PDT were created for each model that PDT is included in.
This means that if you have multiple models in the same project, and more than one model includes the view file containing that PDT, it will be built separately for each model. So, you might see many tables for the same PDT. As of Looker 3.30, multiple versions of a PDT will only be created when needed for some reason.
In order to prevent many copies of the same PDT prior to Looker 3.30, consider being selective with which view files are included in each model. For example, instead of using
- include: "*.view.lookml"
consider listing the view files you want to include individually. Or, use a naming system for view files so that you can include all normal view files at once, but list the included PDTs separately, like so:
- include: "table_*.view.lookml"
- include: "pdt_one.view.looml"
- include: "pdt_three.view.looml"