Anyone? I'm trying several different things and still stuck in about the same place. In this code:

        selected = document_table.select(where, \
          order_by=[sqlalchemy.desc(document_table.columns.last_viewed)])
        proxy = selected.execute() #This is the error that gets the problem
        return proxy

I was trying to follow the documentation below, but I still get the same "AttributeError: 'NoneType' object has no attribute 'connect'":

Simple Select

A select is done by constructing a Select object with the proper arguments, adding any extra arguments if desired, then calling its execute() method.

from sqlalchemy import *

# use the select() function defined in the sql package
s = select([users ])

# or, call the select() method off of a Table object
s = users.select()

# then, call execute on the Select object:
sqlc = s.execute()

# the SQL text of any clause object can also be viewed via the str() call:
>>> str(s)
SELECT users .user_id, users. user_name, users.password FROM users


On 4/1/06, Jonathan Hayward http://JonathansCorner.com < [EMAIL PROTECTED]> wrote:
The error is still there. I tried to specify a connection:


    engine = \
      sqlalchemy.create_engine("sqlite", {"filename":DOCUMENT_ROOT + \
      "alchemy.db"})
    pool = sqlalchemy.pool.QueuePool(get_connection)

and get_connection is:

def get_connection():
    return sqlite.connect(DOCUMENT_ROOT + "alchemy.db")

Am I barking up the wrong tree, or do I need to do something more to tell it where to look for its connections?


On 4/1/06, Jonathan Hayward http://JonathansCorner.com <[EMAIL PROTECTED]> wrote:
When I tried to call .execute() for a Select object, I get the following error:

Traceback (most recent call last):
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 5807, in ?
    multitasking.start_oracle()
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 3474, in start_oracle
    self.run_oracle()
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 3435, in run_oracle
    self.handle_oracle_query(newsocket, address)
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 3382, in handle_oracle_query
    generate_output()
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 5122, in generate_output
    current_frame.display()
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 2776, in display
    build_output_for_appropriate_search_results()
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 4551, in build_output_for_appropriate_search_results
    get_cgi("title_prefix"), criteria)
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 574, in get_search_results
    return self.get_information("search_results", (query_string, \
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 511, in get_information
    parameters)
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 556, in get_information_internal
    result = my_search.search()
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 3696, in search
    return self.database_search()
  File "/server1/users/jonathan/creations/inventions/software/insight/alchemy", line 3689, in database_search
    order_by=[sqlalchemy.desc(document_table.columns.last_viewed)]).execute()
  File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 374, in execute
  File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 272, in execute
  File "build/bdist.linux-i686/egg/sqlalchemy/engine.py", line 492, in execute_compiled
  File "build/bdist.linux-i686/egg/sqlalchemy/engine.py", line 349, in connection
  File "build/bdist.linux-i686/egg/sqlalchemy/pool.py", line 79, in connect
  File "build/bdist.linux-i686/egg/sqlalchemy/pool.py", line 101, in __init__
  File "build/bdist.linux-i686/egg/sqlalchemy/pool.py", line 138, in get
  File "build/bdist.linux-i686/egg/sqlalchemy/pool.py", line 219, in <lambda>
AttributeError: 'NoneType' object has no attribute 'connect'

Is this a symptom that I don't have a database connection? After initially specifying mysql, I have:

    engine = \
      sqlalchemy.create_engine("sqlite", {"filename":DOCUMENT_ROOT + \
      "alchemy.db"})

but in the directory referred to by DOCUMENT_ROOT, there is no alchemy.db.

What do I need to do to create the database file if it doesn't exist? Is there anything else I need to do to connect?
--
++ Jonathan Hayward,

[EMAIL PROTECTED]

** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail (gmail.com) account, please tell me!



--
++ Jonathan Hayward, [EMAIL PROTECTED]
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail ( gmail.com) account, please tell me!



--
++ Jonathan Hayward, [EMAIL PROTECTED]
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail ( gmail.com) account, please tell me!

Reply via email to