POST
|
GO TIT figured out! DOESN'T WORK: tableChk = "table=" + addsTable if cursor.tables(tableChk).fetchone(): WORKS: if cursor.tables(table=addsTable).fetchone(): Thanks for the input, though, Jake!
... View more
08-19-2014
10:36 AM
|
0
|
0
|
412
|
POST
|
Hi Jake! The issue here is more with the table "existing" than making the actual change. In the original script (not part of the one I posted here), I am able to use an ALTER statement to update the LOCATIONS table. But when I try to use the if cursor.tables(tableChk).fetchone(): syntax when tableChk = "table='LOCATIONS'" the script still tells me that the Table does not exist (basically that cursor.tables(tablechk).fetchone() = Nothing). Hope this helps! I know this isn't ArcPy, but if you have any other ideas, I'd love to hear them!
... View more
08-19-2014
09:54 AM
|
0
|
1
|
412
|
POST
|
Has anyone else used pyodbc to work around versioning schema change limitations in SDE using Python? Cursor - pyodbc - Cursor API documentation - Python ODBC library - Google Project Hosting I'm running into a wall when trying to concatenate the query to find the Add table that is related to a table in my SDE. Almost certain this doesn't have anything to do with Esri, but probably the module I am using. I posted the code on /r/python and /r/learnpython, but no responses so far, so figured this was worth a shot. I can get the regID from the sde_table_registry and concatenate the adds table ('a123'). But when I use PYODBC syntax to check for the table, it says the table does not exist (which it DOES). Even if I don't concatenate and just use the name of a table (in this example, LOCATIONS, commented out on line 34), it still says the table doesn't exist. I've attached the entire script. Here's the portion of the code that breaks (see Bold line). Thanks in advanced for any help!: #Find Locations Add table print "Checking for the Location Adds Table..." locTable = "LOCATIONS" cursor.execute('select registration_id from sde_table_registry where table_name = ?', (locTable,)) row = cursor.fetchone() if row: regID = row[0] print regID ##WORKS! addsTable = "a" + str(regID) print addsTable ##WORKS! #Alter Locations Add table if it exists tableChk = "table=" + addsTable print tableChk ##WORKS! #tableChk = "table='LOCATIONS'" if cursor.tables(tableChk).fetchone(): print "Altering the Locations Add table" alterAddsTable = "'ALTER TABLE " + addsTable + " ALTER COLUMN [Comments] [nvarchar](255) NULL'" print alterAddsTable ## cursor.execute(alterAddsTable) ## cursor.commit() print "Completed successfully" else: print "Location Add table does not exist" ##<<< This is the response I get.
... View more
08-19-2014
08:22 AM
|
0
|
4
|
1081
|
POST
|
You shouldn't need to set up an ODBC connection to get this to work. There may just be a syntax error in your code. I already see a few syntax error, so you might want to review your code again. How are you executing the script? In IDLE?
... View more
08-19-2014
08:00 AM
|
0
|
0
|
205
|
POST
|
Just to chime in here... I was running a BAT script from Task Scheduler that called a python script. I could run it from Windows Explorer or the command line, but it was failing with the same error when running from Task Scheduler, "Faulting module name: AfCore_libFNP.dll_unloaded". In the BAT file, I was referencing: <Drive>:\Python27\ArcGIS10.1\python.exe When I changed the path to: <Drive>:\Python27\ArcGISx6410.1\python.exe the Task ran successfully. If you are running the app on a 64-bit server, try using the x64 directory path to python.exe instead. Worked for me.
... View more
03-17-2014
10:31 AM
|
0
|
0
|
350
|
POST
|
Was this functionality ever implemented? We have the need to distribute a template for gathering data to our clients, who would all have different base layers but would have one common set of feature classes/shapefiles to edit. We need to be able to open a Quick Project template with the editable layers ON TOP of a "basemap" map. Why have this option if it is not able to be activated for any quick template? Please explain how I might be able to enable this option when using a quick template. Thanks, emeline
... View more
01-09-2014
06:44 AM
|
0
|
0
|
166
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|