<?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: SQL express back up with date in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1391#M171</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After adding the trace back it came back as not having arcpy module. Once i added the module it ran fine.&lt;/P&gt;&lt;P&gt;Would a better alternative be arcpy.ExportXMLWorkspaceDocument_management or be the same?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Jun 2017 19:08:21 GMT</pubDate>
    <dc:creator>CCWeedcontrol</dc:creator>
    <dc:date>2017-06-22T19:08:21Z</dc:date>
    <item>
      <title>SQL express back up with date</title>
      <link>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1387#M167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to back up a SQL express database but with the date of when the backup was created added to the end (Owls06222017.bak). Is this possible if so how?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I tried the following but did not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;db, backup_path + db + time.strftime("%m%d%y")+ r'.bak'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import pyodbc, datetime, fnmatch 

conn = pyodbc.connect('DRIVER={SQL Server};SERVER=GIS7\SQLEXPRESS;Trusted_Connection=yes', autocommit=True)&amp;nbsp; 
backup_path = 'C:\\temp\\'&amp;nbsp; 
db = "Owls"&amp;nbsp; 
&amp;nbsp; 
def backup_db(conn, db, backup_path):&amp;nbsp; 
&amp;nbsp; cur = conn.cursor()&amp;nbsp; 
&amp;nbsp; try:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.execute('BACKUP DATABASE ? TO DISK=?', [db, backup_path + db + time.strftime("%m%d%y")+ r'.bak'])&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; while cur.nextset():&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.close()&amp;nbsp; 
&amp;nbsp; except:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Unable to backup: ' + db&amp;nbsp; 
&amp;nbsp; 
backup_db(conn, db, backup_path)&amp;nbsp; 
&amp;nbsp; 
conn.close()&amp;nbsp; 
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:04:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1387#M167</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-10T20:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: SQL express back up with date</title>
      <link>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1388#M168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How did it not work, exactly?&amp;nbsp; What were the errors or results you didn't expect?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 18:15:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1388#M168</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-06-22T18:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: SQL express back up with date</title>
      <link>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1389#M169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it returned &lt;/P&gt;&lt;P&gt;cant backup: Owls&lt;BR /&gt;Done&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 18:22:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1389#M169</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2017-06-22T18:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: SQL express back up with date</title>
      <link>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1390#M170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For debugging purposes, how about you remove the try:except block so you can see the actual error message.&amp;nbsp; Or, have your except clause print the error message and stack trace as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 18:24:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1390#M170</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-06-22T18:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: SQL express back up with date</title>
      <link>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1391#M171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After adding the trace back it came back as not having arcpy module. Once i added the module it ran fine.&lt;/P&gt;&lt;P&gt;Would a better alternative be arcpy.ExportXMLWorkspaceDocument_management or be the same?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 19:08:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1391#M171</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2017-06-22T19:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: SQL express back up with date</title>
      <link>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1392#M172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't administer geodatabases enough to have an informed opinion on your follow-up question.&amp;nbsp; That said, I think the caution note in &lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/export-xml-workspace-document.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/export-xml-workspace-document.htm"&gt;Export XML Workspace Document—Help | ArcGIS Desktop&lt;/A&gt; strongly implies the answer isn't to use that tool for managing data itself:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ededed; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;The output XML workspace document can be very large when you copy both the data and the schema. Generally, this alternative is not recommended for copying geodatabase data. Alternatives for making a geodatabase copy include the use of the &lt;/SPAN&gt;&lt;SPAN style="-webkit-font-smoothing: antialiased; color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ededed; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;A class="" href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/copy.htm" style="color: #007ac2; text-decoration: none;"&gt;Copy&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ededed; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; tool or the &lt;/SPAN&gt;&lt;SPAN style="-webkit-font-smoothing: antialiased; color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ededed; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;A class="" href="http://desktop.arcgis.com/en/arcmap/latest/tools/analysis-toolbox/clip.htm" style="color: #007ac2; text-decoration: none;"&gt;Clip&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ededed; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; tool to extract subsets of the data. In addition, tools in the &lt;/SPAN&gt;&lt;A class="" href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/an-overview-of-the-package-toolset.htm" style="color: #007ac2; text-decoration: none; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ededed;"&gt;Package toolset&lt;/A&gt;&lt;SPAN style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ededed; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; provides tools to consolidate, package, and share layers, map documents, address locators, and geoprocessing results.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Since this question has already been answered, maybe ask another question in the &lt;A href="https://community.esri.com/groups/geodatabase?sr=search&amp;amp;searchId=af6bec87-2501-47bf-91d5-63c244bc7247&amp;amp;searchIndex=0"&gt;https://community.esri.com/groups/geodatabase?sr=search&amp;amp;searchId=af6bec87-2501-47bf-91d5-63c244bc7247&amp;amp;searchIndex=0&lt;/A&gt;‌ or &lt;A href="https://community.esri.com/community/gis/managing-data?sr=search&amp;amp;searchId=c73670d4-2ccf-4af2-9825-d278a06e9c6a&amp;amp;searchIndex=0"&gt;https://community.esri.com/community/gis/managing-data?sr=search&amp;amp;searchId=c73670d4-2ccf-4af2-9825-d278a06e9c6a&amp;amp;searchIndex=0&lt;/A&gt;‌ places.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 19:30:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sql-express-back-up-with-date/m-p/1392#M172</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-06-22T19:30:45Z</dc:date>
    </item>
  </channel>
</rss>

