In a standalone script, I am trying to use arcpy.MakeTableView_management(). I'm including a "where clause" in the parameters in order to include only certain records in the resulting Table View. With the ArcMap arcpy runtime, it worked, but with Pro, the "where clause" gets ignored - it has no effect. It doesn't throw an error; the script just runs into trouble later on because it is trying to work with records that it's not designed to work with.
I have tried a variety of different where clauses that target a variety of fields in the source table. None have an effect. I tried manually doing Select by Attributes in Pro (rather than in the script), and that worked fine. I even copied the SQL from the Pro Select by Attributes GUI into my script, but still it had no effect.
I can probably come up with a workaround, but this function should work! Or at least I'd like to know why it isn't working.
The input table is a SQL Server database table, not from any kind of geodatabase.
Here are the relevant lines: (of course my script uses the real names, and bus_lic_tv is used later in the script)
import arcpy
arcpy.env.workspace = r"C:\Path\to\Geodatabase.gdb"
table_data = r"C:\Users\adailey\AppData\Roaming\Esri\ArcGISPro\Favorites\DatabaseName.sde\Database.dbo.TableName"
bus_lic_tv = arcpy.MakeTableView_management(table_data, "bus_lic_no_null_apns", where_clause='APN IS NOT NULL')
Does anyone know why the "where clause" is being ignored?? Thank you!