Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with inserting data #12

Open
skrzepto opened this issue Aug 19, 2016 · 2 comments
Open

Issue with inserting data #12

skrzepto opened this issue Aug 19, 2016 · 2 comments

Comments

@skrzepto
Copy link

On a regulat pgsql db this works fine but when i tried to to use testing.postgresql it throws this error

Note: the data shown is fake and I am not leaking any personal info as this was created by the faker class

It seems that Accessing class variables its treating it as a table

class AccountStatus(IntEnum):
    """
    Describes the status of a registered person.
    """
    INACTIVE = 0
    ACTIVE = 1
    BOT = 2
    PENDING = 3
    ON_VACATION = 4
    LOCKED = 5
    LOCKED_BY_ADMIN = 6
    DISABLED = 8
    SPAMCHECK_AWAITING = 9
    SPAMCHECK_DENIED = 10
    SPAMCHECK_MANUAL = 11

    def do_executemany(self, cursor, statement, parameters, context=None):
>       cursor.executemany(statement, parameters)
E       ProgrammingError: (psycopg2.ProgrammingError) missing FROM-clause entry for table "accountstatus"
E       LINE 2: ... NULL, NULL, NULL, '-', '-', NULL, NULL, NULL, 1, AccountSta...
E                                                                    ^
E        [SQL: 'INSERT INTO people (id, username, password, fullname, ircnick, avatar, avatar_id, introduction, postal_address, country_code, locale, birthday, birthday_month, telephone, facsimile, affiliation, bio, timezone, gpg_fingerprint, ssh_key, email, recovery_email, bugzilla_email, email_token, unverified_email, security_question, security_answer, login_attempt, password_token, old_password, certificate_serial, status, status_timestamp, privacy, email_alias, blog_rss, latitude, longitude, fas_token, github_token, twitter_token, login_timestamp, creation_timestamp, update_timestamp) VALUES (%(id)s, %(username)s, %(password)s, %(fullname)s, %(ircnick)s, %(avatar)s, %(avatar_id)s, %(introduction)s, %(postal_address)s, %(country_code)s, %(locale)s, %(birthday)s, %(birthday_month)s, %(telephone)s, %(facsimile)s, %(affiliation)s, %(bio)s, %(timezone)s, %(gpg_fingerprint)s, %(ssh_key)s, %(email)s, %(recovery_email)s, %(bugzilla_email)s, %(email_token)s, %(unverified_email)s, %(security_question)s, %(security_answer)s, %(login_attempt)s, %(password_token)s, %(old_password)s, %(certificate_serial)s, %(status)s, CURRENT_TIMESTAMP, %(privacy)s, %(email_alias)s, %(blog_rss)s, %(latitude)s, %(longitude)s, %(fas_token)s, %(github_token)s, %(twitter_token)s, %(login_timestamp)s, %(creation_timestamp)s, CURRENT_TIMESTAMP)'] [parameters: ({'username': u'bob', 'bugzilla_email': None, 'certificate_serial': 1, 'locale': u'en_US', 'fas_token': None, 'telephone': None, 'affiliation': None, 'security_question': u'-', 'country_code': u'US', 'timezone': u'UTC', 'avatar_id': u'[email protected]', 'id': 0, 'privacy': 1, 'introduction': 'hello', 'password_token': None, 'latitude': 43, 'birthday_month': None, 'creation_timestamp': datetime.datetime(2011, 11, 28, 14, 46, 44, tzinfo=<UTC>), 'email': u'[email protected]', 'recovery_email': None, 'status': <AccountStatus.DISABLED: 8>, 'bio': None, 'login_timestamp': None, 'postal_address': u'783 Wiegand Lights Apt. 566\nNorth Marceloview, ND 52464-4628', 'unverified_email': None, 'ssh_key': None, 'birthday': None, 'email_alias': True, 'ircnick': None, 'password': '$6$GA8meLk2obnJCHBz$KWqipYAXkxpCvJ0SEpZcp8pyCrJ1qjAhzMIqNtpnTALmXilKlaxuggi2NRpViHen0isvl0BN3cuqdkvQ5jwkO.', 'twitter_token': None, 'gpg_fingerprint': None, 'login_attempt': None, 'github_token': None, 'email_token': None, 'longitude': 27, 'blog_rss': None, 'security_answer': u'-', 'facsimile': None, 'avatar': u'https://seccdn.libravatar.org/avatar/c961431faea38ed65bfd982cf2e31bd0', 'fullname': u'bob', 'old_password': None}, {'username': u'jerry', 'bugzilla_email': None, 'certificate_serial': 1, 'locale': u'en_US', 'fas_token': None, 'telephone': None, 'affiliation': None, 'security_question': u'-', 'country_code': u'FR', 'timezone': u'UTC', 'avatar_id': u'[email protected]', 'id': 1, 'privacy': 0, 'introduction': 'intro', 'password_token': None, 'latitude': None, 'birthday_month': None, 'creation_timestamp': datetime.datetime(2013, 8, 28, 14, 46, 44, tzinfo=<UTC>), 'email': u'[email protected]', 'recovery_email': None, 'status': <AccountStatus.ACTIVE: 1>, 'bio': 'biography of a simple individual', 'login_timestamp': None, 'postal_address': None, 'unverified_email': None, 'ssh_key': None, 'birthday': None, 'email_alias': True, 'ircnick': None, 'password': '$6$GA8meLk2obnJCHBz$KWqipYAXkxpCvJ0SEpZcp8pyCrJ1qjAhzMIqNtpnTALmXilKlaxuggi2NRpViHen0isvl0BN3cuqdkvQ5jwkO.', 'twitter_token': None, 'gpg_fingerprint': None, 'login_attempt': None, 'github_token': None, 'email_token': None, 'longitude': None, 'blog_rss': None, 'security_answer': u'-', 'facsimile': None, 'avatar': u'https://seccdn.libravatar.org/avatar/284459354f2531f6923b7e4e57c06792', 'fullname': u'jerry', 'old_password': None}, {'username': u'mike', 'bugzilla_email': None, 'certificate_serial': 1, 'locale': u'en_US', 'fas_token': None, 'telephone': None, 'affiliation': None, 'security_question': u'-', 'country_code': u'CA', 'timezone': u'UTC', 'avatar_id': u'[email protected]', 'id': 2, 'privacy': 1, 'introduction': None, 'password_token': None, 'latitude': Decimal('85.5335165'), 'birthday_month': None, 'creation_timestamp': datetime.datetime(2016, 2, 28, 14, 46, 44, tzinfo=<UTC>), 'email': u'[email protected]', 'recovery_email': None, 'status': <AccountStatus.PENDING: 3>, 'bio': 'i <3 oss', 'login_timestamp': None, 'postal_address': u'487 Brown Greens Apt. 191\nSmithamton, AL 33044-3467', 'unverified_email': None, 'ssh_key': None, 'birthday': None, 'email_alias': True, 'ircnick': None, 'password': '$6$GA8meLk2obnJCHBz$KWqipYAXkxpCvJ0SEpZcp8pyCrJ1qjAhzMIqNtpnTALmXilKlaxuggi2NRpViHen0isvl0BN3cuqdkvQ5jwkO.', 'twitter_token': None, 'gpg_fingerprint': None, 'login_attempt': None, 'github_token': None, 'email_token': None, 'longitude': Decimal('74.295654'), 'blog_rss': None, 'security_answer': u'-', 'facsimile': None, 'avatar': None, 'fullname': u'mike', 'old_password': None})]
@tk0miya
Copy link
Owner

tk0miya commented Aug 20, 2016

It seems your SQL has broken. I don't know that is releated with testing.postgresql or not.
Could you check your program again?

@skrzepto
Copy link
Author

@tk0miya

The sql statement works fine in a regular postgres db and inserts the data. It seems that it crashes when I use this package. Let me try it on another machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants