Call external script from Model Builder or python

398
4
Jump to solution
05-06-2019 07:30 AM
Ulises
by
Occasional Contributor II

Hi,

I'm not a developer but we managed to create a python script produced by Model Builder to automate some daily task.  There are some sql statements that need to be run between procedures in the model.  Is it possible to call an external sql script from our file to secure the whole process from a single execution?  Any help is appreciated...thanks

0 Kudos
1 Solution

Accepted Solutions
DuncanHornby
MVP Frequent Contributor

A simple google search threw up this blog that explains how to call a batch file from within python.

If you want to maintain your workflow as a model then you would write your python code that calls the batch file in the model only calculate value tool. Have a look at help file for that.

View solution in original post

4 Replies
DuncanHornby
MVP Frequent Contributor

How do you normally run you SQL statements? Do you spin up an instance of MS Access and execute it, run it in a custom VB .net console app or manually type it into MySQL?

0 Kudos
Ulises
by
Occasional Contributor II

I usually schedule a batch file that run the sql command thru the command prompt.  Our data is in an enterprise geodatabase.

0 Kudos
DuncanHornby
MVP Frequent Contributor

A simple google search threw up this blog that explains how to call a batch file from within python.

If you want to maintain your workflow as a model then you would write your python code that calls the batch file in the model only calculate value tool. Have a look at help file for that.

View solution in original post

Ulises
by
Occasional Contributor II

Thanks Duncan, I'll check it out and let you know how it goes.