<?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: Using STR function in Arcpy Statement in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778176#M1458</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, that one worked after removing the double 'arcpy'.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Feb 2019 15:07:52 GMT</pubDate>
    <dc:creator>Brian_McLeer</dc:creator>
    <dc:date>2019-02-04T15:07:52Z</dc:date>
    <item>
      <title>Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778166#M1448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have created an SDE database in which I have copied feature&amp;nbsp;classes from my production database from State Plane into WGS 84 for web mapping applications. The final step is to create views, and I am trying to automate the process as I have hundreds of feature classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below, I am trying to make a list of all the feature classes and use the name of the feature class. The middle parameter starts with a prefix of &lt;STRONG&gt;v_&amp;nbsp;&lt;/STRONG&gt;then grabs the feature class name (ie: v_watermeters). The third variable is the SQL statement used to create the view definition, where it grabs all the fields (SELECT * FROM ) then I want to use the feature class name (ie: SELECT * FROM watermeters).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having trouble with the third variable and concatenating the string values to make valid code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are currently on ArcGIS 10.3.1 and SQL Server 2012.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Database Connections\\Server Database sde.sde"&lt;/SPAN&gt;
featureclasses &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFeatureClasses&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; featureclasses&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateDatabaseView_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
 fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Database Connections\\Server Database sde.sde"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"v_"&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;featureclasses&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"select * from "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;featureclasses&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:45:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778166#M1448</guid>
      <dc:creator>Brian_McLeer</dc:creator>
      <dc:date>2021-12-12T08:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778167#M1449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Consider the following, and note that the individual item is 'fc' and the list, which never changes, is 'featureclasses':&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;featureclasses &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'a'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'b'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'c'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; featureclasses&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'start'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; featureclasses&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'end'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

start
a &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'a'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'b'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'c'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
end
start
b &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'a'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'b'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'c'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
end
start
c &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'a'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'b'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'c'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
end&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:45:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778167#M1449</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-12T08:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778168#M1450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In line 8, you refer twice to 'featureclasses' which is the name of the list you are iterating through.&amp;nbsp; I'm not sure why you are doing that.&amp;nbsp; It seems to me you would want the value of fc instead, the current item of the list.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Personally, I prefer to use the format() function when I can to concatenate characters and variable values.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;for fc in featureclasses:
 arcpy.arcpy.CreateDatabaseView_management(
 fc, os.path.join("Database Connections\\Server Database sde.sde",'v_{}'.format(fc), 'select * from {}'.format(fc)&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:46:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778168#M1450</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-12T08:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778169#M1451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# ---- what you have&lt;/SPAN&gt;
featureclasses &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'a'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'b'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'c'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;'v_'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;featureclasses&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"v_['a', 'b', 'c']"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ---- what you want, one at a time&lt;/SPAN&gt;

fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; featureclasses&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;'v_'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;'v_a'&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;/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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:46:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778169#M1451</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T08:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778170#M1452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I updated line 6 and 7 with your code but seems to still report an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; File "C:\path\to\python\file.py", line 8, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; arcpy.arcpy.CreateDatabaseView_management(fc, os.path.join("Database Connections\\Server DB sde.sde",'v_{}'.format(fc), 'select * from {}'.format(fc)))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", line 4069, in CreateDatabaseView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt;ERROR 000837: The workspace is not the correct workspace type.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt;ERROR 000735: View Definition: Value is required&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt;Failed to execute (CreateDatabaseView).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Database Connections\\Server DB sde.sde"&lt;/SPAN&gt;
featureclasses &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFeatureClasses&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
 
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; featureclasses&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateDatabaseView_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Database Connections\\Server DB sde.sde"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'v_{}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'select * from {}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:46:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778170#M1452</guid>
      <dc:creator>Brian_McLeer</dc:creator>
      <dc:date>2021-12-12T08:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778171#M1453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check your parameters against the help.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/create-database-view.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/create-database-view.htm"&gt;Create Database View—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The tool takes 3 parameters.&lt;/P&gt;&lt;P&gt;1.) database&lt;/P&gt;&lt;P&gt;2.) view name&lt;/P&gt;&lt;P&gt;3.) view definition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, am I seeing double or do I see "arcpy.arcpy"? That is a red flag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2019 04:17:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778171#M1453</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2019-02-01T04:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778172#M1454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not familiar with the CreateDataBaseView_management() function, but error 837 catches my attention.&amp;nbsp; Again, just my personal preference, but I would create a varable to hold the database name parameter and insert it rather than using the os.path.join() method where you do. I just like laying things out...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2019 13:03:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778172#M1454</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-02-01T13:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778173#M1455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try following code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Database Connections\\Server Database sde.sde"&lt;/SPAN&gt;
featureclasses &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFeatureClasses&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; featureclasses&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateDatabaseView_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;"Database Connections\\Server Database sde.sde"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"v_"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'.'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"select * from "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; fc&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:46:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778173#M1455</guid>
      <dc:creator>FrédéricPRALLY</dc:creator>
      <dc:date>2021-12-12T08:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778174#M1456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not the guy looking for a solution, but I'm sure he'll give it a spin....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2019 15:26:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778174#M1456</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-02-01T15:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778175#M1457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think &lt;CODE&gt;fc&lt;SPAN class=""&gt;.&lt;/SPAN&gt;split&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;'.'&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;-1&lt;/SPAN&gt;&lt;SPAN class=""&gt;] &lt;/SPAN&gt;&lt;/CODE&gt;will work with more platforms.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2019 16:05:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778175#M1457</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-02-01T16:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using STR function in Arcpy Statement</title>
      <link>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778176#M1458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, that one worked after removing the double 'arcpy'.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2019 15:07:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/using-str-function-in-arcpy-statement/m-p/778176#M1458</guid>
      <dc:creator>Brian_McLeer</dc:creator>
      <dc:date>2019-02-04T15:07:52Z</dc:date>
    </item>
  </channel>
</rss>

