Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#82 Must use implicit DEFAULT NULL when _fromDatabase=True

closed-works-for-me
Oleg Broytman
Postgres (36)
5
2008-03-07
2005-04-28
Anonymous
No

(PostgreSQL 8.0, psycopg 1.1.18, SQLObject 0.6.1)

Have the following table:

CREATE TABLE urls
(
id serial NOT NULL,
url varchar(80) NOT NULL,
download_finished timestamp,
email varchar(80) NOT NULL,
activated timestamp NOT NULL DEFAULT now(),
CONSTRAINT urls_pkey PRIMARY KEY (id)
)
WITHOUT OIDS;

And the following definition:

import sqlobject
c=sqlobject.connectionForURI('postgres://postgres:pass@localhost/db')

class Urls(sqlobject.SQLObject):
_connection = c
_fromDatabase = True

Then, in python shell:

>>> Urls(email='leha@leha', url='urltest')
....
TypeError: Urls() did not get expected keyword argument
downloadFinished
>>> Urls(email='leha@leha', url='urltest',
downloadFinished=None)
<Urls 3L url='urltest' downloadFinished=None
email='leha@leha' activated =<DateTime object for
'2005-04-29 00:35:34.80' at cc02a0>>

As you can see SQLObject honours explicit DEFAULT
declaration (now() for activated column), but no
implicit (NULL for download_finished).

Discussion

  • Oleg Broytman
    Oleg Broytman
    2005-05-26

    • assigned_to: nobody --> phd
     
  • Oleg Broytman
    Oleg Broytman
    2005-05-26

    Logged In: YES
    user_id=4799

    This is probably Postgres issue. Can you look at
    PostgresConnection.columnsFromSchema(), run the colQuery
    manually and report the results?

     
  • Oleg Broytman
    Oleg Broytman
    2008-03-07

    • status: open --> closed-works-for-me
     
  • Oleg Broytman
    Oleg Broytman
    2008-03-07

    Logged In: YES
    user_id=4799
    Originator: NO

    test = Urls(email='leha@leha', url='urltest')
    print test.downloadFinished

    prints 'None' under Postgres and SQLite, SQLObject 0.9.4.