Issue 1:
Migrated issue, originally created by Anonymous

I get three "Bullet list ends without a blank line; unexpected unindent." warnings when I 'make html' in sqlalchemy/doc/build.

(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.

The sphinx docs say:

"Nested lists are possible, but be aware that they must be separated from the parent list items by blank lines:"

* this is
* a list

* with a nested list
* and some subitems

* and here the parent list continues

http://sphinx.pocoo.org/rest.html#lists-and-quotes

Attached is a diff.

Some 'id' attribute values change as a result of this diff -- I'm totally new to sphinx & not sure if this matters. For example:

(mydevenv)diana@diana-laptop:~/workspace/sqlalchemy/doc/build$ diff /home/diana/dbengine.html.before /home/diana/dbengine.html.after
53c53
< Version: <span class="versionnum">0.6beta2</span> Last Updated: 02/22/2010 13:50:25
---
> Version: <span class="versionnum">0.6beta2</span> Last Updated: 02/22/2010 13:49:03
292c292
< <p id="index-9">Connection facts:</p>
---
> <p id="index-7">Connection facts:</p>
339c339
< <p id="index-10">Transaction Facts:</p>
---
> <p id="index-8">Transaction Facts:</p>

Also, are there tests I should run for the docs? I did run 'python setup.pt test':

Ran 2141 tests in 230.564s

OK

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.

Attachments: sphinx-lists.diff

Issue 2:
I'm trying to remove duplicates from my table by running the following SQL Server query:

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 > 1

where the table testtable has three columns:

name NVARCHAR(50) --represents sensor name

date_hour DATETIME --represents when the sensor value was taken

value INT --represents sensor value

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.

I used to run the following code to do that in version 1.3.22:

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 > 1"))
engn.execute(q2) #engn was previously created by create_engine()

However, the same code does not run in version 1.4.15 producing the following error:

---------------------------------------------------------------------------
ArgumentError Traceback (most recent call last)
<ipython-input-37-1ca2629b15cf> in <module>
3 ''')])
4 cte = q.cte('deldup')
----> 5 q2 = delete(cte, text("RN > 1"))
6 engn.execute(q2) #engn was previously created by create_engine()

<string> in delete(table, whereclause, bind, returning, prefixes, **dialect_kw)

<string> 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 )
--> 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(
-> 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(
--> 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):
--> 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,
--> 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
--> 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:
--> 211 raise exception
212 finally:
213 # credit to

ArgumentError: subject table for an INSERT, UPDATE or DELETE expected, got <sqlalchemy.sql.selectable.CTE at 0x1b1ff07e708; deldup>.

No matter how hard I try, I keep encountering the same error at delete(cte) 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?

Thank you for going through my long long ticket. I'll be looking forward to your replies :)