Select to view content in your preferred language

Publishing of a GP Tool is changing my string queries

354
2
12-02-2022 09:50 AM
DougBrowning
MVP Esteemed Contributor

When you publish a script GP tool it tries to "fix" the paths for me.  I get that part.  But it is also changing my query strings and I cannot figure out why or how to stop it.

I have tried all 3 of these ways

exp="PrimaryKey IN(" + terrapkString +" )")
exp = f'PrimaryKey IN({terrapkString})'
exp = "PrimaryKey IN({})".format(terrapkString)
arcpy.Append_management(tablePath, os.path.join(outGDB, table), expression=exp)

But the server keeps doing something like this.  Changing it in two places

terrapkString = terrapkString + g_ESRI_variable_5 + pk + "',"

g_ESRI_variable_5 = "'"
g_ESRI_variable_6 = 'PrimaryKey IN({})'
g_ESRI_variable_7 = 'PrimaryKey IN('
g_ESRI_variable_8 = ' )'

exp = g_ESRI_variable_6.format(terrapkString)

I am out of options to try now I think.  What is tripping it up here?  It still works but I want to know which format it would like.

thanks a lot

0 Kudos
2 Replies
Declan
by
Emerging Contributor

Here I am, two years later with the same issue. If anybody has a hunch, please let me know!

DEWright_CA
Frequent Contributor

Yup; same issue. ESRI making arbitrary changes to scripts to try and make them "server safe" while actually breaking things is a horrible strategy. 

I have a "Idea" posted about this; take a look... Improved GP Tool Publishing - Approve Changes to scripts before publish