<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic arcpy.mapping.tableView.replaceDataSource and multiple databases in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-mapping-tableview-replacedatasource-and/m-p/503091#M39528</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We are migrating our geodatabase and multiple business databases to a new server.I am trying to use arcpy.mapping.tableView.replaceDataSource to migrate the OLEDB tables in our MXDs to the new server. The tables may come from any one of the databases. Is there a way to identify which database the table is in? Is there a way to change the server and keep the database the same?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Feb 2013 17:12:07 GMT</pubDate>
    <dc:creator>EricPfirman</dc:creator>
    <dc:date>2013-02-13T17:12:07Z</dc:date>
    <item>
      <title>arcpy.mapping.tableView.replaceDataSource and multiple databases</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-tableview-replacedatasource-and/m-p/503091#M39528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We are migrating our geodatabase and multiple business databases to a new server.I am trying to use arcpy.mapping.tableView.replaceDataSource to migrate the OLEDB tables in our MXDs to the new server. The tables may come from any one of the databases. Is there a way to identify which database the table is in? Is there a way to change the server and keep the database the same?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2013 17:12:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-tableview-replacedatasource-and/m-p/503091#M39528</guid>
      <dc:creator>EricPfirman</dc:creator>
      <dc:date>2013-02-13T17:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.tableView.replaceDataSource and multiple databases</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-tableview-replacedatasource-and/m-p/503092#M39529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, you can use the layer properties (workspacePath) to print the workspace. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
from arcpy import mapping as m

mapdoc = r'G:\Map_Documents\Walkin_requests\Customer_map.mxd'

mxd = m.MapDocument(mapdoc)
for lyr in m.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports('DATASOURCE'):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print '%s:&amp;nbsp; %s' %(lyr.name,lyr.workspacePath)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next, you can use the find and replace workspace paths to change your workspaces for each table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
old = r'G:\Data\Geodatabase\Cedar_County.mdb' # old worspace 1
new = r'G:\Data\Geodatabase\Cedar_County.gdb' # new workspace 1

if lyr.workspacePath == r'G:\Some\path\gdb':
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.replaceWorkspaces(old,'ACCESS_WORKSPACE',new,'FILEGDB_WORKSPACE')

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:04:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-tableview-replacedatasource-and/m-p/503092#M39529</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T22:04:41Z</dc:date>
    </item>
  </channel>
</rss>

