<?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 LRS Metadata. Where to find it using SQL? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/lrs-metadata-where-to-find-it-using-sql/m-p/1213759#M59966</link>
    <description>&lt;P&gt;Prior, (I can confirm in version 2.8), I could check the LRS metadata using a query to the LRS_METADATA table in a Enterprise geodatabase.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import xml.etree.ElementTree as ET
import arcpy
import os

arcpy.env.workspace = r""
arcpy.env.workspace = r"U:\Documents\ArcGIS\Projects\UPDM2018\LIN0228\UPDM2018_DataOwner.sde"

def is_table_in_LRS(tablename):
    with arcpy.da.SearchCursor(os.path.join(arcpy.env.workspace, "LRS_METADATA"), ['Metadata']) as cursor:
        for row in cursor:
            raw_metadata = row[0].tobytes()

    xml = str(raw_metadata.decode("utf-8"))
    
    root = ET.fromstring(xml)
    event_tables = [elem.get('TableName') for elem in root.iter('EventTable')]
    print(event_tables)
    return tablename in event_tables

res = is_table_in_LRS("MyTable")
print(res)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using ArcGIS Pro 2.9, I added an event table to my LRS, and tried the script above, but as result i just got the list of event tables without the new one.&lt;/P&gt;&lt;P&gt;after restarting arcgis pro, my Ide, checking the properties of the LRS and the properties of the Feature class, i was pulling my hair because the visual information from ArcGIS pro was correct, but the information from the script was not.&lt;/P&gt;&lt;P&gt;After making a double check in the documentation, i found &lt;A href="https://pro.arcgis.com/en/pro-app/2.9/help/production/location-referencing-pipelines/alrs-data-model.htm" target="_self"&gt;here&lt;/A&gt;, that i can get the lrs metadata using the arcpy.Describe method.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import xml.etree.ElementTree as ET
import arcpy
import os

arcpy.env.workspace = r""
arcpy.env.workspace = r"U:\Documents\ArcGIS\Projects\UPDM2018\LIN0228\UPDM2018_DataOwner.sde"

def is_table_in_LRS(tablename):
    desc = arcpy.Describe(os.path.join(arcpy.env.workspace, "UPDM2018.Dataowner.P_Integrity\\UPDM2018.Dataowner.ALRS"))

    xml = desc.lrsMetadata
    
    root = ET.fromstring(xml)
    event_tables = [elem.get('TableName') for elem in root.iter('EventTable')]
    print(event_tables)
    return tablename in event_tables

res = is_table_in_LRS("P_DASurveyReadings")
print(res)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ok, that is good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know, where it is stored? can i get rid of the LRS_METADATA table? I would like to make this script but in SQL, where should i look for the REAL Lrs metadata?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Sep 2022 11:46:41 GMT</pubDate>
    <dc:creator>Cristian_Galindo</dc:creator>
    <dc:date>2022-09-19T11:46:41Z</dc:date>
    <item>
      <title>LRS Metadata. Where to find it using SQL?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/lrs-metadata-where-to-find-it-using-sql/m-p/1213759#M59966</link>
      <description>&lt;P&gt;Prior, (I can confirm in version 2.8), I could check the LRS metadata using a query to the LRS_METADATA table in a Enterprise geodatabase.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import xml.etree.ElementTree as ET
import arcpy
import os

arcpy.env.workspace = r""
arcpy.env.workspace = r"U:\Documents\ArcGIS\Projects\UPDM2018\LIN0228\UPDM2018_DataOwner.sde"

def is_table_in_LRS(tablename):
    with arcpy.da.SearchCursor(os.path.join(arcpy.env.workspace, "LRS_METADATA"), ['Metadata']) as cursor:
        for row in cursor:
            raw_metadata = row[0].tobytes()

    xml = str(raw_metadata.decode("utf-8"))
    
    root = ET.fromstring(xml)
    event_tables = [elem.get('TableName') for elem in root.iter('EventTable')]
    print(event_tables)
    return tablename in event_tables

res = is_table_in_LRS("MyTable")
print(res)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using ArcGIS Pro 2.9, I added an event table to my LRS, and tried the script above, but as result i just got the list of event tables without the new one.&lt;/P&gt;&lt;P&gt;after restarting arcgis pro, my Ide, checking the properties of the LRS and the properties of the Feature class, i was pulling my hair because the visual information from ArcGIS pro was correct, but the information from the script was not.&lt;/P&gt;&lt;P&gt;After making a double check in the documentation, i found &lt;A href="https://pro.arcgis.com/en/pro-app/2.9/help/production/location-referencing-pipelines/alrs-data-model.htm" target="_self"&gt;here&lt;/A&gt;, that i can get the lrs metadata using the arcpy.Describe method.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import xml.etree.ElementTree as ET
import arcpy
import os

arcpy.env.workspace = r""
arcpy.env.workspace = r"U:\Documents\ArcGIS\Projects\UPDM2018\LIN0228\UPDM2018_DataOwner.sde"

def is_table_in_LRS(tablename):
    desc = arcpy.Describe(os.path.join(arcpy.env.workspace, "UPDM2018.Dataowner.P_Integrity\\UPDM2018.Dataowner.ALRS"))

    xml = desc.lrsMetadata
    
    root = ET.fromstring(xml)
    event_tables = [elem.get('TableName') for elem in root.iter('EventTable')]
    print(event_tables)
    return tablename in event_tables

res = is_table_in_LRS("P_DASurveyReadings")
print(res)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ok, that is good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know, where it is stored? can i get rid of the LRS_METADATA table? I would like to make this script but in SQL, where should i look for the REAL Lrs metadata?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 11:46:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/lrs-metadata-where-to-find-it-using-sql/m-p/1213759#M59966</guid>
      <dc:creator>Cristian_Galindo</dc:creator>
      <dc:date>2022-09-19T11:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: LRS Metadata. Where to find it using SQL?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/lrs-metadata-where-to-find-it-using-sql/m-p/1213761#M59967</link>
      <description>&lt;P&gt;Moreover, I just change the name of the LRS......the name was not changed in the LRS_Metadata table......so.....programmatically speaking......how i am going to be able to retrieve the name of the LRS, in order to apply the script above??&lt;/P&gt;&lt;P&gt;[EDIT 1] I tried with ListDatasets..... no luck&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 13:08:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/lrs-metadata-where-to-find-it-using-sql/m-p/1213761#M59967</guid>
      <dc:creator>Cristian_Galindo</dc:creator>
      <dc:date>2022-09-19T13:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: LRS Metadata. Where to find it using SQL?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/lrs-metadata-where-to-find-it-using-sql/m-p/1216839#M60385</link>
      <description>&lt;P&gt;The information that is required was moved to the GDB_ITEMS table, it can be fetched with a cursor:&lt;/P&gt;&lt;PRE&gt;identifier = &lt;SPAN class=""&gt;None&lt;/SPAN&gt;
&lt;SPAN class=""&gt;with&lt;/SPAN&gt; arcpy.da.SearchCursor(os.path.join(arcpy.env.workspace,&lt;SPAN class=""&gt;"sde.GDB_ITEMTYPES"&lt;/SPAN&gt;), [&lt;SPAN class=""&gt;'UUID'&lt;/SPAN&gt;], where_clause=&lt;SPAN class=""&gt;"Name = 'Location Referencing Dataset'"&lt;/SPAN&gt;) &lt;SPAN class=""&gt;as&lt;/SPAN&gt; type_items_cursor:
        &lt;SPAN class=""&gt;for&lt;/SPAN&gt; type_object &lt;SPAN class=""&gt;in&lt;/SPAN&gt; type_items_cursor:
            identifier = type_object[&lt;SPAN class=""&gt;0&lt;/SPAN&gt;]
&lt;SPAN class=""&gt;del&lt;/SPAN&gt; type_items_cursor

lrs_path = &lt;SPAN class=""&gt;None&lt;/SPAN&gt;
&lt;SPAN class=""&gt;with&lt;/SPAN&gt; arcpy.da.SearchCursor(os.path.join(arcpy.env.workspace,&lt;SPAN class=""&gt;"sde.GDB_ITEMS"&lt;/SPAN&gt;), [&lt;SPAN class=""&gt;'Path'&lt;/SPAN&gt;], where_clause=&lt;SPAN class=""&gt;f"Type = '&lt;SPAN class=""&gt;{identifier}&lt;/SPAN&gt;'"&lt;/SPAN&gt;) &lt;SPAN class=""&gt;as&lt;/SPAN&gt; items_cursor:
        &lt;SPAN class=""&gt;for&lt;/SPAN&gt; item &lt;SPAN class=""&gt;in&lt;/SPAN&gt; items_cursor:
            lrs_path = item[&lt;SPAN class=""&gt;0&lt;/SPAN&gt;]
&lt;SPAN class=""&gt;del&lt;/SPAN&gt; items_cursor
&lt;SPAN class=""&gt;print&lt;/SPAN&gt;(lrs_path)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 06:28:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/lrs-metadata-where-to-find-it-using-sql/m-p/1216839#M60385</guid>
      <dc:creator>Cristian_Galindo</dc:creator>
      <dc:date>2022-09-28T06:28:43Z</dc:date>
    </item>
  </channel>
</rss>

