{"action":"closed","issue":{"url":"https://api.github.com/repos/coleifer/peewee/issues/990","repository_url":"https://api.github.com/repos/coleifer/peewee","labels_url":"https://api.github.com/repos/coleifer/peewee/issues/990/labels{/name}","comments_url":"https://api.github.com/repos/coleifer/peewee/issues/990/comments","events_url":"https://api.github.com/repos/coleifer/peewee/issues/990/events","html_url":"https://github.com/coleifer/peewee/issues/990","id":160745063,"number":990,"title":"Zip argument #2 must support iteration for pk_row","user":{"login":"leerobert","id":6231418,"avatar_url":"https://avatars.githubusercontent.com/u/6231418?v=3","gravatar_id":"","url":"https://api.github.com/users/leerobert","html_url":"https://github.com/leerobert","followers_url":"https://api.github.com/users/leerobert/followers","following_url":"https://api.github.com/users/leerobert/following{/other_user}","gists_url":"https://api.github.com/users/leerobert/gists{/gist_id}","starred_url":"https://api.github.com/users/leerobert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leerobert/subscriptions","organizations_url":"https://api.github.com/users/leerobert/orgs","repos_url":"https://api.github.com/users/leerobert/repos","events_url":"https://api.github.com/users/leerobert/events{/privacy}","received_events_url":"https://api.github.com/users/leerobert/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-16T19:50:45Z","updated_at":"2016-07-14T09:06:34Z","closed_at":"2016-07-14T09:06:34Z","body":"I cannot figure out this issue for the life of me. On my test database, created primarily by the ORM create_table routines I do not experience this issue. When I deploy the tables to our production database and other users write partitions that listen to one of the ORM databases this issue occurs.\r\n\r\n# Models\r\n\r\n```python\r\nclass BaseModel(Model):\r\n\t\"\"\"\r\n\tThe BaseModel defines the abstract model bean \r\n\tthat all Models will inherit. It defines the \r\n\tdatabase where extended beans will connect. \r\n\tIt also contains the common data fields that all \r\n\tbeans will share in common: \r\n\r\n\t\tmodel_created_at \r\n\t\t\tThe datetime object for when the bean was created\r\n\t\tmodel_updated_at\r\n\t\t\tThe datetime object for when the bean was last updated\r\n\t\tstatus\r\n\t\t\tThe status of the model bean. Provides functionality for \r\n\t\t\tperforming soft delete of inactive instances, rather than \r\n\t\t\thard deletes of data. \r\n\t\"\"\"\r\n\r\n\tmodel_created_at = DateTimeField(default=datetime.now)\r\n\tmodel_updated_at = DateTimeField(default=None, null=True)\r\n\tis_active = BooleanField(default=True)\r\n\r\n\tclass Meta:\r\n\t\t# the database all BaseModel beans will connect\r\n\t\tdatabase = soos_db\t\r\n\r\n\tdef save(self, *args, **kwargs):\r\n\t\t\"\"\"\r\n\t\tOverrides the peewee save functionality to allow for\r\n\t\tupdating of the updated_at datetime field. \r\n\t\t\"\"\"\r\n\t\tself.model_updated_at = datetime.now()\r\n\t\treturn super(BaseModel, self).save(*args, **kwargs)\r\n\r\n\tdef soft_delete(self):\r\n\t\t\"\"\"\r\n\t\tDoes a soft delete of all beans by giving a status of \r\n\t\tdeleted to the instance and changing the is_active\r\n\t\tflag to False. \r\n\t\t\"\"\"\r\n\t\tself.is_active = False\r\n\t\treturn self.save()\r\n\r\n\tdef __repr__(self):\r\n\t\t\"\"\"\r\n\t\tDefines the 'toString' functionality for all extended\r\n\t\tmodels. It grabs the class name, field names, and field\r\n\t\tvalues associated to the extended class and displays it\r\n\t\twhen str or other repr displays are made on the object. \r\n\t\t\"\"\"\r\n\t\tfield_values = [ ' {0}:{1}'.format(field, getattr(self, field)) \r\n\t\t\tfor field in self._meta.fields.keys() ]\r\n\t\treturn '<' + self.__class__.__name__ + ''.join(field_values) + '>'\r\n\r\nclass SOOSItem(BaseModel):\r\n\t\"\"\"\r\n\tThe SOOSItem is the base scanned out of stock item\r\n\t\"\"\"\r\n\titem = ForeignKeyField(Item)\r\n\tsite = ForeignKeyField(Site)\r\n\tvendor = ForeignKeyField(Vendor, null=True)\r\n\tmanufacturer = ForeignKeyField(Manufacturer, null=True)\r\n\tretailer = ForeignKeyField(Retailer, null=True)\r\n\r\n\tupc = CharField(max_length=13)\r\n\tdescription = CharField()\r\n\tprice = FloatField()\r\n\tquantity_sold = FloatField()\r\n\tquantity_sold_weekly = FloatField()\r\n\tin_inventory = FloatField()\r\n\tlost_sales = FloatField()\r\n\tscanned_at = DateTimeField()\r\n```\r\n\r\nHere is some example data that I throw in to create the SOOSItem model. \r\n\r\n```python\r\n>>> data = {'item': Item.get(id=2324), 'site': Site.get(id=90369), 'vendor': 92760, 'manufacturer': None, 'upc': '1820096147', 'description': 'BUD LT AZULITAS 24PK CAN', 'price': 0, 'quantity_sold': 0, 'quantity_sold_weekly': 0, 'in_inventory': 0, 'lost_sales': 0.0, 'scanned_at': datetime.now()}\r\n>>> SOOSItem.create(**data)\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/usr/local/worx/oosworx/env/lib/python3.5/site-packages/peewee.py\", line 4494, in create\r\n    inst.save(force_insert=True)\r\n  File \"/usr/local/worx/oosworx/oosworx/models.py\", line 54, in save\r\n    return super(BaseModel, self).save(*args, **kwargs)\r\n  File \"/usr/local/worx/oosworx/env/lib/python3.5/site-packages/peewee.py\", line 4680, in save\r\n    pk_from_cursor = self.insert(**field_dict).execute()\r\n  File \"/usr/local/worx/oosworx/env/lib/python3.5/site-packages/peewee.py\", line 3221, in execute\r\n    in zip(meta.get_primary_key_fields(), pk_row)]\r\nTypeError: zip argument #2 must support iteration\r\n```\r\n\r\nAny thoughts at all what might be causing this issue? I compared both definitions in the production and development databases (postgres) and they match word to word."}}
{"actor":{"display_login":"coleifer"}}