English 中文(简体)
页: 1
原标题:Google app engine item / transaction data model

我正在研究一个GAE/2008/4项目,该项目有物品和交易。

首先,我们尝试使用一种有参考财产的物品和交易,但这使问题变得十分复杂。

因此,我们转而采用一刀式的版本,将交易数据直接储存在该项目内,结果造成许多特性没有被使用,因为并非所有项目都涉及交易。

我期望它加快步伐,但这是这样做的最佳方式吗?

了解:

  • we expect to have lots of transactions and many more items.
  • we need to check the transaction status (actually stored in the item s status).
  • there is only one transaction possible per item but there are many different kind of transactions.

是否有更好的解决办法?

EDIT:

问题在于,我主要询问使用交易属性的物品,但只有2个,即规定最多一次,而且经常更新交易。

实际上,我有这样的东西:

MyItem(db.Model):

owner = db.ReferenceProperty(MyUser)  
descr = db.StringProperty()  

status = db.IntegerProperty()  # contains item status / transaction status

tx_actor = db.emailProperty()
tx_token = db.StringProperty()
latest_tx_date = db.DateTimeProperty()
最佳回答

由于它绘制了1至1幅地图,它oil倒了你需要询问的项目或交易的许多属性——这些属性需要加以指数化,以及你经常写出贵件或交易。

An example where it s fine to merge them: - You rarely write your merged item/transaction object. - You query on a small set of attributes, many of the attributes do not need to be indexed. - When you do queries, you usually want both the item AND the transaction.

An example where it s a bad idea to merge them: - Your item has many indexed attributes, but your transaction has very few. But you need to update your transaction frequently. In this case you d be better off keeping them separate, because every time you write the transaction, you incur all the write costs of updating the indices for the item.

另一种选择是,如果DON T需要询问交易,将交易作为JSON编码储存,那么你就不必界定所有属性。 你们也可以使用“扩大”类别。

为了得到更好的答案,你最好不要列举贵项目/交易所看的事例,以及你希望处理的询问类型。

问题回答

暂无回答




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签