Problem creating docs when importing sqlalchemy

Andrew Cooper avatarAndrew Cooper created an issue

This may or may not be a sphinx issue I'm running sqlalchemy 0.8 and I know the docs for that project were created using sphinx 1.1.3

I'm a newbie to sphinx. I created a new project using quickstart Then also created the rst's using sphinx-apidoc

ran the make and got ...

[Andy@bagend sphinx]$ cat  /tmp/sphinx-err-tXJH98.log
# Sphinx version: 1.2b1
# Python version: 2.6.5
# Docutils version: 0.11 release
# Jinja2 version: 2.7.1
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/", line 247, in main, filenames)
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/", line 211, in build
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/builders/", line 211, in build_update
    'out of date' % len(to_build))
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/builders/", line 231, in build
    purple, length):
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/builders/", line 131, in status_iterator
    for item in iterable:
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/", line 458, in update_generator
    self.read_doc(docname, app=app)
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/", line 606, in read_doc
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/", line 217, in publish
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/readers/", line 72, in read
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/readers/", line 78, in parse
    self.parser.parse(self.input, document)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 172, in parse, document, inliner=self.inliner)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 170, in run
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/", line 239, in run
    context, state, transitions)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/", line 460, in check_line
    return method(match, context, next_state)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 2726, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 395, in new_subsection
    node=section_node, match_titles=True)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 282, in nested_parse
    node=node, match_titles=match_titles)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 195, in run
    results =, input_lines, input_offset)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/", line 239, in run
    context, state, transitions)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/", line 460, in check_line
    return method(match, context, next_state)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 2299, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 2311, in explicit_construct
    return method(self, expmatch)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 2054, in directive
    directive_class, match, type_name, option_presets)
  File "/usr/local/lib/python2.6/site-packages/docutils-0.11-py2.6.egg/docutils/parsers/rst/", line 2103, in run_directive
    result =
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/ext/", line 1346, in run
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/ext/", line 755, in generate
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/ext/", line 679, in document_members
    check_module=members_check_module and not isattr)
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/ext/", line 755, in generate
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/ext/", line 1087, in document_members
    ModuleLevelDocumenter.document_members(self, all_members)
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/ext/", line 648, in document_members
    for (mname, member, isattr) in self.filter_members(members, want_all):
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/ext/", line 616, in filter_members
    not keep, self.options)
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/", line 357, in emit_firstresult
    for result in self.emit(event, *args):
  File "/usr/local/lib/python2.6/site-packages/Sphinx-1.2b1-py2.6.egg/sphinx/", line 349, in emit
    self.debug2('[app] emitting event: %r%s', event, repr(args)[:100])
  File "build/bdist.linux-i686/egg/sqlalchemy/", line 496, in __repr__
    [repr(x) for x in self.columns] +
  File "build/bdist.linux-i686/egg/sqlalchemy/", line 1031, in __repr__
    self.table.description or "table=None")] +
  File "build/bdist.linux-i686/egg/sqlalchemy/", line 1306, in __repr__
    return "ForeignKey(%r)" % self._get_colspec()
  File "build/bdist.linux-i686/egg/sqlalchemy/", line 1356, in _get_colspec
    return "%s.%s" % (_column.table.fullname, _column.key)
AttributeError: 'Alias' object has no attribute 'fullname'

Comments (7)

  1. Mike Bayer

    not following fully but it seems like some logging in Sphinx is being handed a completed SQLAlchemy object (which is the part that does not seem normal?) which itself is not prepared to be called under __repr__().

    what is the .rst source that produces this ?

  2. Andrew Cooper
    class Biz(Base):
      __tablename__ = 'biz'
      id = Column(BigInteger, primary_key=True)
      name =  Column(String(64))
      birthstamp =  Column(DateTime,
      description =  Column(String(255))
    Supplier = aliased(Biz)
    class Rollup(Base):
      __tablename__ = 'rollup'
      id = Column(BigInteger, primary_key=True,)
      testdate =  Column(DateTime,
      bizID = Column(BigInteger,ForeignKey(
      biz = relationship("Biz", foreign_keys=[bizID])
      supplierID = Column(BigInteger,ForeignKey(

    I've tracked it down to the use of aliased() and it falls over whenthe alais is used comment out the above supplierID line and its OK

    The RST for this file is

    MyDB Module
    .. automodule:: MyDB

    Hope this helps


  3. Mike Bayer

    OK, well the mapping is wrong - it doesnt make any sense to say ForeignKey( when Supplier is an aliased construct. change that to be or better yet the string "".

  4. Georg Brandl

    That said, I'll guard this debug2() call, as it is not very helpful for Sphinx users to get exceptions coming from completely unrelated code bugs.

  5. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.