<p dir="auto"><strong>Migrated issue, originally created by Anonymous</strong></p>
<p dir="auto">I get three "Bullet list ends without a blank line; unexpected unindent." warnings when I 'make html' in sqlalchemy/doc/build.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(mydevenv)diana@diana-laptop:~/workspace/sqlalchemy/doc/build$ make html
mkdir -p output/html output/doctrees
sphinx-build -b html -A mako_layout=html -d output/doctrees   . output/html
Running Sphinx v0.6.4
loading pickled environment... not found
building [html](html): targets for 43 source files that are out of date
updating environment: 43 added, 0 changed, 0 removed
reading sources... [100%](100%) sqlexpression                                                                                      
/home/diana/workspace/sqlalchemy/doc/build/dbengine.rst:67: (WARNING/2) Bullet list ends without a blank line; unexpected unindent.
/home/diana/workspace/sqlalchemy/doc/build/dbengine.rst:79: (WARNING/2) Bullet list ends without a blank line; unexpected unindent.
/home/diana/workspace/sqlalchemy/doc/build/dbengine.rst:85: (WARNING/2) Bullet list ends without a blank line; unexpected unindent.
/home/diana/workspace/sqlalchemy/doc/build/intro.rst:: (WARNING/2) Duplicate explicit target name: &quot;setuptools&quot;.
looking for now-outdated files... none found
pickling environment... done
checking consistency... /home/diana/workspace/sqlalchemy/doc/build/copyright.rst:: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%](100%) sqlexpression                                                                                       
writing additional files... genindex search
copying images... sqla_arch_small.jpg
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 5 warnings."><pre class="notranslate"><code class="notranslate">(mydevenv)diana@diana-laptop:~/workspace/sqlalchemy/doc/build$ make html
mkdir -p output/html output/doctrees
sphinx-build -b html -A mako_layout=html -d output/doctrees   . output/html
Running Sphinx v0.6.4
loading pickled environment... not found
building [html](html): targets for 43 source files that are out of date
updating environment: 43 added, 0 changed, 0 removed
reading sources... [100%](100%) sqlexpression                                                                                      
/home/diana/workspace/sqlalchemy/doc/build/dbengine.rst:67: (WARNING/2) Bullet list ends without a blank line; unexpected unindent.
/home/diana/workspace/sqlalchemy/doc/build/dbengine.rst:79: (WARNING/2) Bullet list ends without a blank line; unexpected unindent.
/home/diana/workspace/sqlalchemy/doc/build/dbengine.rst:85: (WARNING/2) Bullet list ends without a blank line; unexpected unindent.
/home/diana/workspace/sqlalchemy/doc/build/intro.rst:: (WARNING/2) Duplicate explicit target name: "setuptools".
looking for now-outdated files... none found
pickling environment... done
checking consistency... /home/diana/workspace/sqlalchemy/doc/build/copyright.rst:: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%](100%) sqlexpression                                                                                       
writing additional files... genindex search
copying images... sqla_arch_small.jpg
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 5 warnings.
</code></pre></div>
<p dir="auto">The sphinx docs say:</p>
<p dir="auto">"Nested lists are possible, but be aware that they must be separated from the parent list items by blank lines:"</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="* this is
* a list

  * with a nested list
  * and some subitems

* and here the parent list continues"><pre class="notranslate"><code class="notranslate">* this is
* a list

  * with a nested list
  * and some subitems

* and here the parent list continues
</code></pre></div>
<p dir="auto"><a href="http://sphinx.pocoo.org/rest.html#lists-and-quotes" rel="nofollow">http://sphinx.pocoo.org/rest.html#lists-and-quotes</a></p>
<p dir="auto">Attached is a diff.</p>
<p dir="auto">Some 'id' attribute values change as a result of this diff -- I'm totally new to sphinx &amp; not sure if this matters. For example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(mydevenv)diana@diana-laptop:~/workspace/sqlalchemy/doc/build$ diff /home/diana/dbengine.html.before /home/diana/dbengine.html.after 
53c53
&lt;             Version: &lt;span class=&quot;versionnum&quot;&gt;0.6beta2&lt;/span&gt; Last Updated: 02/22/2010 13:50:25
---
&gt;             Version: &lt;span class=&quot;versionnum&quot;&gt;0.6beta2&lt;/span&gt; Last Updated: 02/22/2010 13:49:03
292c292
&lt; &lt;p id=&quot;index-9&quot;&gt;Connection facts:&lt;/p&gt;
---
&gt; &lt;p id=&quot;index-7&quot;&gt;Connection facts:&lt;/p&gt;
339c339
&lt; &lt;p id=&quot;index-10&quot;&gt;Transaction Facts:&lt;/p&gt;
---
&gt; &lt;p id=&quot;index-8&quot;&gt;Transaction Facts:&lt;/p&gt;"><pre class="notranslate"><code class="notranslate">(mydevenv)diana@diana-laptop:~/workspace/sqlalchemy/doc/build$ diff /home/diana/dbengine.html.before /home/diana/dbengine.html.after 
53c53
&lt;             Version: &lt;span class="versionnum"&gt;0.6beta2&lt;/span&gt; Last Updated: 02/22/2010 13:50:25
---
&gt;             Version: &lt;span class="versionnum"&gt;0.6beta2&lt;/span&gt; Last Updated: 02/22/2010 13:49:03
292c292
&lt; &lt;p id="index-9"&gt;Connection facts:&lt;/p&gt;
---
&gt; &lt;p id="index-7"&gt;Connection facts:&lt;/p&gt;
339c339
&lt; &lt;p id="index-10"&gt;Transaction Facts:&lt;/p&gt;
---
&gt; &lt;p id="index-8"&gt;Transaction Facts:&lt;/p&gt;
</code></pre></div>
<p dir="auto">Also, are there tests I should run for the docs? I did run 'python setup.pt test':</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Ran 2141 tests in 230.564s

OK"><pre class="notranslate"><code class="notranslate">Ran 2141 tests in 230.564s

OK
</code></pre></div>
<p dir="auto">Note that this is my first ever ticket and diff to an open source project, so please let me know if I'm doing something wrong.</p>
<hr>
<p dir="auto">Attachments: <a href="../wiki/imported_issue_attachments/1700/sphinx-lists.diff">sphinx-lists.diff</a></p>
<p dir="auto">I'm trying to remove duplicates from my table by running the following SQL Server query:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="WITH deldup AS (  
    SELECT name,  
        date_hour,  
        ROW_NUMBER() OVER (PARTITION BY name, date_hour ORDER BY value DESC) AS RN FROM testtable  
)  
DELETE FROM deldup WHERE RN &gt; 1"><pre class="notranslate"><code class="notranslate">WITH deldup AS (  
    SELECT name,  
        date_hour,  
        ROW_NUMBER() OVER (PARTITION BY name, date_hour ORDER BY value DESC) AS RN FROM testtable  
)  
DELETE FROM deldup WHERE RN &gt; 1
</code></pre></div>
<p dir="auto">where the table <strong>testtable</strong> has three columns:</p>
<ul dir="auto">
<li>name NVARCHAR(50) --represents sensor name</li>
<li>date_hour DATETIME --represents when the sensor value was taken</li>
<li>value INT --represents sensor value<br>
There should exist only one [name] and [date_hour] combination in table, but sometimes duplicates get inserted. By runing the above query, I'm trying to keep the row with the highest [value] and remove the rest.</li>
</ul>
<p dir="auto">I used to run the following code to do that in version 1.3.22:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from sqlalchemy import select, delete, text

q = select([text('''
    name, date_hour, ROW_NUMBER() OVER(PARTITION BY name, date_hour ORDER BY value DESC) AS RN FROM testtable
''')])
cte = q.cte('deldup')
q2 = delete(cte, text(&quot;RN &gt; 1&quot;))
engn.execute(q2) #engn was previously created by create_engine()"><pre class="notranslate"><code class="notranslate">from sqlalchemy import select, delete, text

q = select([text('''
    name, date_hour, ROW_NUMBER() OVER(PARTITION BY name, date_hour ORDER BY value DESC) AS RN FROM testtable
''')])
cte = q.cte('deldup')
q2 = delete(cte, text("RN &gt; 1"))
engn.execute(q2) #engn was previously created by create_engine()
</code></pre></div>
<p dir="auto">However, the same code does not run in version 1.4.15 producing the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---------------------------------------------------------------------------
ArgumentError                             Traceback (most recent call last)
&lt;ipython-input-37-1ca2629b15cf&gt; in &lt;module&gt;
      3 ''')])
      4 cte = q.cte('deldup')
----&gt; 5 q2 = delete(cte, text(&quot;RN &gt; 1&quot;))
      6 engn.execute(q2) #engn was previously created by create_engine()

&lt;string&gt; in delete(table, whereclause, bind, returning, prefixes, **dialect_kw)

&lt;string&gt; in __init__(self, table, whereclause, bind, returning, prefixes, **dialect_kw)

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\util\deprecations.py in warned(fn, *args, **kwargs)
    296                         stacklevel=3,
    297                     )
--&gt; 298             return fn(*args, **kwargs)
    299 
    300         doc = fn.__doc__ is not None and fn.__doc__ or &quot;&quot;

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\sql\dml.py in __init__(self, table, whereclause, bind, returning, prefixes, **dialect_kw)
   1414         self._bind = bind
   1415         self.table = coercions.expect(
-&gt; 1416             roles.DMLTableRole, table, apply_propagate_attrs=self
   1417         )
   1418         if returning:

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\sql\coercions.py in expect(role, element, apply_propagate_attrs, argname, post_inspect, **kw)
    199     else:
    200         return impl._implicit_coercions(
--&gt; 201             original_element, resolved, argname=argname, **kw
    202         )
    203 

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\sql\coercions.py in _implicit_coercions(self, element, resolved, argname, **kw)
    240 
    241     def _implicit_coercions(self, element, resolved, argname=None, **kw):
--&gt; 242         self._raise_for_expected(element, argname, resolved)
    243 
    244     def _raise_for_expected(

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\sql\coercions.py in _raise_for_expected(self, element, argname, resolved, **kw)
    428             advice=advice,
    429             code=code,
--&gt; 430             **kw
    431         )
    432 

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\sql\coercions.py in _raise_for_expected(self, element, argname, resolved, advice, code, err)
    268             msg += &quot; &quot; + advice
    269 
--&gt; 270         util.raise_(exc.ArgumentError(msg, code=code), replace_context=err)
    271 
    272 

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\util\compat.py in raise_(***failed resolving arguments***)
    209 
    210         try:
--&gt; 211             raise exception
    212         finally:
    213             # credit to

ArgumentError: subject table for an INSERT, UPDATE or DELETE expected, got &lt;sqlalchemy.sql.selectable.CTE at 0x1b1ff07e708; deldup&gt;."><pre class="notranslate"><code class="notranslate">---------------------------------------------------------------------------
ArgumentError                             Traceback (most recent call last)
&lt;ipython-input-37-1ca2629b15cf&gt; in &lt;module&gt;
      3 ''')])
      4 cte = q.cte('deldup')
----&gt; 5 q2 = delete(cte, text("RN &gt; 1"))
      6 engn.execute(q2) #engn was previously created by create_engine()

&lt;string&gt; in delete(table, whereclause, bind, returning, prefixes, **dialect_kw)

&lt;string&gt; in __init__(self, table, whereclause, bind, returning, prefixes, **dialect_kw)

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\util\deprecations.py in warned(fn, *args, **kwargs)
    296                         stacklevel=3,
    297                     )
--&gt; 298             return fn(*args, **kwargs)
    299 
    300         doc = fn.__doc__ is not None and fn.__doc__ or ""

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\sql\dml.py in __init__(self, table, whereclause, bind, returning, prefixes, **dialect_kw)
   1414         self._bind = bind
   1415         self.table = coercions.expect(
-&gt; 1416             roles.DMLTableRole, table, apply_propagate_attrs=self
   1417         )
   1418         if returning:

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\sql\coercions.py in expect(role, element, apply_propagate_attrs, argname, post_inspect, **kw)
    199     else:
    200         return impl._implicit_coercions(
--&gt; 201             original_element, resolved, argname=argname, **kw
    202         )
    203 

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\sql\coercions.py in _implicit_coercions(self, element, resolved, argname, **kw)
    240 
    241     def _implicit_coercions(self, element, resolved, argname=None, **kw):
--&gt; 242         self._raise_for_expected(element, argname, resolved)
    243 
    244     def _raise_for_expected(

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\sql\coercions.py in _raise_for_expected(self, element, argname, resolved, **kw)
    428             advice=advice,
    429             code=code,
--&gt; 430             **kw
    431         )
    432 

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\sql\coercions.py in _raise_for_expected(self, element, argname, resolved, advice, code, err)
    268             msg += " " + advice
    269 
--&gt; 270         util.raise_(exc.ArgumentError(msg, code=code), replace_context=err)
    271 
    272 

c:\users\new user\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\util\compat.py in raise_(***failed resolving arguments***)
    209 
    210         try:
--&gt; 211             raise exception
    212         finally:
    213             # credit to

ArgumentError: subject table for an INSERT, UPDATE or DELETE expected, got &lt;sqlalchemy.sql.selectable.CTE at 0x1b1ff07e708; deldup&gt;.
</code></pre></div>
<p dir="auto">No matter how hard I try, I keep encountering the same error at <code class="notranslate">delete(cte)</code> part. Are CTEs not usable in Insert/Update/Delete anymore? If not, how can I achieve the functionality of the SQL query I listed at the top?</p>
<p dir="auto">Thank you for going through my long long ticket. I'll be looking forward to your replies :)</p>