小编isr*_*ick的帖子

GroupResult在Celery中不是JSON可序列化的

在这里做类似从Celery中的taskset_id检索GroupResult?.但是之后

tasks.save()
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Traceback (most recent call last):


File "/home/rodions/pma/pma/pma/controllers/report/cross_site_stock.py", line 270, in report_cross_site_stock_refresh
    tasks.save()
  File "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/result.py", line 769, in save
    return (backend or self.app.backend).save_group(self.id, self)
  File "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/backends/base.py", line 325, in save_group
    return self._save_group(group_id, result)
  File "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/backends/mongodb.py", line 170, in _save_group
    'result': Binary(self.encode(result)),
  File "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/backends/base.py", line 182, in encode
    _, _, payload = dumps(data, serializer=self.serializer)
  File "/home/rodions/pma/env/local/lib/python2.7/site-packages/kombu-3.0.24-py2.7.egg/kombu/serialization.py", line 164, in dumps
    payload = encoder(data)
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/rodions/pma/env/local/lib/python2.7/site-packages/kombu-3.0.24-py2.7.egg/kombu/serialization.py", line 59, in …
Run Code Online (Sandbox Code Playgroud)

python json celery pyramid

6
推荐指数
0
解决办法
2919
查看次数

sqlalchemy INSERT来自SELECT

我遇到了麻烦.SELECT构造的INSERT编译,但不执行.没有任何错误.如果查看日志文件,您将不会像ISERT INTO ... SELECT ... FROM ....

这是我的代码:

    DBSession.query(ProductMediaGalleryArchive)\
        .filter(ProductMediaGalleryArchive.product_id.in_(pack))\
        .delete(synchronize_session=False)

    query = DBSession.query(
            ProductMediaGallery.code,
            ProductMediaGallery.filename,
            ProductMediaGallery.mimetype,
            ProductMediaGallery.sha1hash,
            ProductMediaGallery.position,
            ProductMediaGallery.excluded,
            ProductMediaGallery.created,
            ProductMediaGallery.updated,
            ProductMediaGallery.id,
            ProductMediaGallery.is_rollover,
            Product.code.label('product_code'),
        ).join((Product, Product.id==ProductMediaGallery.product_id))\
        .filter(ProductMediaGallery.product_id.in_(pack))

    insert(ProductMediaGalleryArchive).from_select(
        (
            ProductMediaGalleryArchive.code,
            ProductMediaGalleryArchive.filename,
            ProductMediaGalleryArchive.mimetype,
            ProductMediaGalleryArchive.sha1hash,
            ProductMediaGalleryArchive.position,
            ProductMediaGalleryArchive.excluded,
            ProductMediaGalleryArchive.created,
            ProductMediaGalleryArchive.updated,
            ProductMediaGalleryArchive.id,
            ProductMediaGalleryArchive.is_rollover,
            ProductMediaGalleryArchive.product_code
        ),
        query
    )
Run Code Online (Sandbox Code Playgroud)

谁知道为什么不表演呢?

python sqlalchemy pyramid

3
推荐指数
1
解决办法
1920
查看次数

标签 统计

pyramid ×2

python ×2

celery ×1

json ×1

sqlalchemy ×1