<?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 Re: How to create hosted feature views including tables in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814588#M2606</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your problem intrigued me so I decided to take a look at the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;create_view&lt;/SPAN&gt; source code. I remember at least 3 other people seeking this functionality and found it's actually&amp;nbsp;quite simple to implement. The behavior was logged as a defect by a colleague, but if you review the source code I think an Enhancement is more appropriate. &lt;SPAN style="text-decoration: underline;"&gt;The information I present here should not be taken as a solution&lt;/SPAN&gt;. Rather, I want it to serve the purpose of bringing awareness to the situation and to provide some insight into how one might troubleshoot these matters. &lt;SPAN style="text-decoration: underline;"&gt;The accepted, supported solution is what I described previously: create the view manually or use the 3 individual methods.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyhow, the file we're interested in&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;arcgis/features/managers.py&lt;/SPAN&gt; - this contains the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;create_view&lt;/SPAN&gt; method. As you may have guessed, this method basically calls the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;createService&lt;/SPAN&gt; and &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;addToDefinition&lt;/SPAN&gt; REST operations.&amp;nbsp;Currently, it is written to only handle &lt;EM&gt;layers&lt;/EM&gt; in the FeatureLayerCollection object and not tables - this is where that limitation comes from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important snippet is this one (here I'm just showing one occurrence but it occurs twice):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;add_def = {
           "layers" : []
          }
if view_layers is None:
    for lyr in fs.layers:
        add_def['layers'].append(
        {
            "adminLayerInfo" : {
                "viewLayerDefinition" :
            {
                "sourceServiceName" : os.path.basename(os.path.dirname(fs.url)),
                "sourceLayerId" : lyr.manager.properties['id'],
                "sourceLayerFields" :  "*"
            }
            },
            "name" : lyr.manager.properties['name']
         })‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, all that needs to be done to enable tables to be created in the view is this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;add_def = {
           "layers" : [],
           "tables" : [] # Add this key
          }
if view_layers is None:
    for lyr in fs.layers:
        add_def['layers'].append(
        {
            "adminLayerInfo" : {
                "viewLayerDefinition" :
            {
                "sourceServiceName" : os.path.basename(os.path.dirname(fs.url)),
                "sourceLayerId" : lyr.manager.properties['id'],
                "sourceLayerFields" :  "*"
            }
            },
            "name" : lyr.manager.properties['name']
         })‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

    # Add the below loop
    for tbl in fs.tables:
        add_def['tables'].append(
        {
            "adminLayerInfo" : {
                "viewLayerDefinition" :
            {
                "sourceServiceName" : os.path.basename(os.path.dirname(fs.url)),
                "sourceLayerId" : tbl.manager.properties['id'],
                "sourceLayerFields" :  "*"
            }
            },
            "name" : tbl.manager.properties['name']
         })‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for asking about this - I hope the information here can help expedite a more permanent solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Earl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:36:26 GMT</pubDate>
    <dc:creator>EarlMedina</dc:creator>
    <dc:date>2021-12-12T09:36:26Z</dc:date>
    <item>
      <title>How to create hosted feature views including tables</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814584#M2602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to create some hosted feature layer views that include the tables as well and I can't seem to find a way to do it. Using the Python API, I am able to either 1) Create a new empty service (as_view), or 2) Create a view from the FeatureCollection, but this leaves away the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code creates a view with only the feature layers, not the tables:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;service = gis.content.get('my_id')&lt;BR /&gt;flc= FeatureLayerCollection.fromitem(service)&lt;BR /&gt;theVw = flc.manager.create_view("newly_created_view)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This code creates a new service, but it is empty:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;gis.content.create_service(name="myTableView",is_view=True)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;When I look at what's happening in ArcGIS Online, when I create a view, I see a combination of 3 REST Calls: 1) Create Service, 2) addToDefinition and 3) update. I am trying to replicate this in Python using the&amp;nbsp;&lt;EM&gt;add_to_defini&lt;/EM&gt;&lt;EM&gt;tion&lt;/EM&gt; fuction, but it does not work, since I would need to run it on a particular layer or table (.e.g. theVw.tables[0].manager.add_to_definition), but if I don't have them in the view, I cannot do anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks! Any help is appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2019 17:49:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814584#M2602</guid>
      <dc:creator>JonathanGaudreau1</dc:creator>
      <dc:date>2019-09-23T17:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create hosted feature views including tables</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814585#M2603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like your situation is described by this defect (logged at version 1.6.1):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;BUG-000122919:&lt;/STRONG&gt; When using ArcGIS API for Python to create a view layer of a feature service that contains a layer and a table, the table is not included in the view layer.&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The workaround is to create the view manually.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems you've captured the traffic when doing this manually and can see the which REST operations are involved? There are two &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;add_to_definition&lt;/SPAN&gt; methods - I believe you want the one that works on FeatureLayerCollection objects. I've not tested this myself but your approach sounds like it would work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Earl&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2019 18:56:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814585#M2603</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2019-09-23T18:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to create hosted feature views including tables</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814586#M2604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, this is what I did, but the FeatureLayerCollection only works for layers, not tables, right?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2019 19:19:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814586#M2604</guid>
      <dc:creator>JonathanGaudreau1</dc:creator>
      <dc:date>2019-09-23T19:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to create hosted feature views including tables</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814587#M2605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to achieve this after using a traffic capture for guidance. I confirm that thebelow operations are needed (I've pointed out the corresponding Python API methods):&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef;"&gt;&lt;TH&gt;REST API&lt;/TH&gt;&lt;TH&gt;Python API&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;createService&lt;/TD&gt;&lt;TD&gt;create_service&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;addToDefinition&lt;/TD&gt;&lt;TD&gt;add_to_definition&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;update&lt;/TD&gt;&lt;TD&gt;update_definition&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Relevant&amp;nbsp;import statements:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;from arcgis import GIS&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;from arcgis.features import FeatureLayerCollection&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;You'll run the below to create a skeleton view - here make sure to set the WKID to match that of the service the view will be based on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;create_service&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;name&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"test_serv"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; service_description&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
                           has_static_data&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; max_record_count&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1000&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
                           supported_query_formats&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'JSON'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; capabilities&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Query'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
                           description&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; copyright_text&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; wkid&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;4326&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
                           create_params&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; service_type&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'featureService'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
                           owner&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; folder&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; item_properties&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; is_view&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once the service is created, load it as a FeatureLayerCollection object (let's supporse we call it&amp;nbsp;&lt;STRONG&gt;test_flc&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next, run &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;add_to_definition&lt;/SPAN&gt;, where the input JSON is what you recorded from the traffic capture (I'm not including it here because the JSON is rather large).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #ff0000;"&gt;test_flc.manager.add_to_definition(input_add_json)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lastly, run&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;update_definition&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;where again the input JSON is from the traffic capture:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: 'courier new', courier, monospace;"&gt;test_flc.manager.update_definition(input_update_json)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Earl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:36:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814587#M2605</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2021-12-12T09:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create hosted feature views including tables</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814588#M2606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your problem intrigued me so I decided to take a look at the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;create_view&lt;/SPAN&gt; source code. I remember at least 3 other people seeking this functionality and found it's actually&amp;nbsp;quite simple to implement. The behavior was logged as a defect by a colleague, but if you review the source code I think an Enhancement is more appropriate. &lt;SPAN style="text-decoration: underline;"&gt;The information I present here should not be taken as a solution&lt;/SPAN&gt;. Rather, I want it to serve the purpose of bringing awareness to the situation and to provide some insight into how one might troubleshoot these matters. &lt;SPAN style="text-decoration: underline;"&gt;The accepted, supported solution is what I described previously: create the view manually or use the 3 individual methods.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyhow, the file we're interested in&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;arcgis/features/managers.py&lt;/SPAN&gt; - this contains the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;create_view&lt;/SPAN&gt; method. As you may have guessed, this method basically calls the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;createService&lt;/SPAN&gt; and &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;addToDefinition&lt;/SPAN&gt; REST operations.&amp;nbsp;Currently, it is written to only handle &lt;EM&gt;layers&lt;/EM&gt; in the FeatureLayerCollection object and not tables - this is where that limitation comes from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important snippet is this one (here I'm just showing one occurrence but it occurs twice):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;add_def = {
           "layers" : []
          }
if view_layers is None:
    for lyr in fs.layers:
        add_def['layers'].append(
        {
            "adminLayerInfo" : {
                "viewLayerDefinition" :
            {
                "sourceServiceName" : os.path.basename(os.path.dirname(fs.url)),
                "sourceLayerId" : lyr.manager.properties['id'],
                "sourceLayerFields" :  "*"
            }
            },
            "name" : lyr.manager.properties['name']
         })‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, all that needs to be done to enable tables to be created in the view is this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;add_def = {
           "layers" : [],
           "tables" : [] # Add this key
          }
if view_layers is None:
    for lyr in fs.layers:
        add_def['layers'].append(
        {
            "adminLayerInfo" : {
                "viewLayerDefinition" :
            {
                "sourceServiceName" : os.path.basename(os.path.dirname(fs.url)),
                "sourceLayerId" : lyr.manager.properties['id'],
                "sourceLayerFields" :  "*"
            }
            },
            "name" : lyr.manager.properties['name']
         })‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

    # Add the below loop
    for tbl in fs.tables:
        add_def['tables'].append(
        {
            "adminLayerInfo" : {
                "viewLayerDefinition" :
            {
                "sourceServiceName" : os.path.basename(os.path.dirname(fs.url)),
                "sourceLayerId" : tbl.manager.properties['id'],
                "sourceLayerFields" :  "*"
            }
            },
            "name" : tbl.manager.properties['name']
         })‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for asking about this - I hope the information here can help expedite a more permanent solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Earl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:36:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814588#M2606</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2021-12-12T09:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create hosted feature views including tables</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814589#M2607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow, that is amazing! Thanks. I changed the python function on my side and now the result takes everything.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Sep 2019 16:08:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/814589#M2607</guid>
      <dc:creator>JonathanGaudreau1</dc:creator>
      <dc:date>2019-09-24T16:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create hosted feature views including tables</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/1562714#M10911</link>
      <description>&lt;P&gt;5 years later and this thread is still useful!&lt;/P&gt;&lt;P&gt;For some reason, I'm unable to use the create_view() function for a service that contains layers and tables (but I was able to do it as a test on another service that also contains layers and tables).&lt;/P&gt;&lt;P&gt;Anyway so as suggested in this thread, I did a create_service(is_view=True) then to this new service I did&amp;nbsp; an add_to_definition() which contains the layers and tables properties.&lt;/P&gt;&lt;P&gt;Only thing I didn't do is an update_definition(), because all the properties seem there. Hope I won't run into trouble in the future!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 17:03:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-create-hosted-feature-views-including/m-p/1562714#M10911</guid>
      <dc:creator>mikaël</dc:creator>
      <dc:date>2024-11-26T17:03:52Z</dc:date>
    </item>
  </channel>
</rss>

