我正在运行这个简单的代码

db.query(SampleType).run().toList();

而我得到一个错误。当我查询某些类型时,不会出现错误,而其他类型则会发生错误。看来我已经填充了数据库并更新了我的类型,现在某些查询无法解码。我没有尝试使用过滤器,但是如果我使用查找某个已知实体的方法,它将可以工作,但是我使用此命令从数据库中删除了所有SampleType,但是现在,我陷入了一些不希望的损坏实体。如何手动擦除数据库?首先,本地数据库实际上位于哪里?

这是实际错误

Bad state: Error while decoding entity (Illegal argument(s): The type argument must not be null., #0      Key.Key (package:gcloud/src/db/models.dart:22:7)
#1      Key.append (package:gcloud/src/db/models.dart:55:16)
#2      ModelDBImpl.fromDatastoreKey (package:gcloud/src/db/model_db_impl.dart:65:23)
#3      ModelKeyProperty.decodePrimitiveValue (package:gcloud/src/db/annotations.dart:179:31)
#4      ListProperty.decodePrimitiveValue (package:gcloud/src/db/annotations.dart:268:65)
#5      _ModelDescription._decodeProperty (package:gcloud/src/db/model_db_impl.dart:427:42)
#6      _ModelDescription.decodeEntity. (package:gcloud/src/db/model_db_impl.dart:416:22)
#7      _HashMap&&_LinkedHashMapMixin.forEach (dart:collection-patch/collection_patch.dart:967)
#8      _ModelDescription.decodeEntity (package:gcloud/src/db/model_db_impl.dart:415:41)
#9      fromDatastoreEntity (package:gcloud/src/db/model_db_impl.dart:124:43)
#10     _MapStream._handleData (dart:async/stream_pipe.dart:233)
#11     _handleData (dart:async/stream_pipe.dart:170)
#12     _rootRunUnary (dart:async/zone.dart:899)
#13     _CustomZone.runUnary (dart:async/zone.dart:801)
#14     _CustomZone.runUnaryGuarded (dart:async/zone.dart:709)
#15     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#16     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
#17     _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:587)
#18     _StreamController._add (dart:async/stream_controller.dart:462)
#19     add (dart:async/stream_controller.dart:410)
#20     List.forEach (dart:core-patch/growable_array.dart:254)
#21     _handlePage (package:gcloud/common.dart:58:23)
#22     _rootRunUnary (dart:async/zone.dart:899)
#23     _CustomZone.runUnary (dart:async/zone.dart:801)
#24     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:496)
#25     _Future._propagateToListeners (dart:async/future_impl.dart:579)
#26     _Future._complete (dart:async/future_impl.dart:325)
#27     Stream.fold. (dart:async/stream.dart:541)
#28     _rootRun (dart:async/zone.dart:888)
#29     _CustomZone.run (dart:async/zone.dart:793)
#30     _CustomZone.runGuarded (dart:async/zone.dart:701)
#31     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:390)
#32     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399)
#33     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:290)
#34     _ForwardingStream._handleDone (dart:async/stream_pipe.dart:110)
#35     _handleDone (dart:async/stream_pipe.dart:178)
#36     _rootRun (dart:async/zone.dart:888)
#37     _CustomZone.run (dart:async/zone.dart:793)
#38     _CustomZone.runGuarded (dart:async/zone.dart:701)
#39     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:390)
#40     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399)
#41     _DelayedDone.perform (dart:async/stream_impl.dart:614)
#42     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:711)
#43     _PendingEvents.schedule. (dart:async/stream_impl.dart:671)
#44     _rootRun (dart:async/zone.dart:888)
#45     _CustomZone.run (dart:async/zone.dart:793)
#46     _CustomZone.runGuarded (dart:async/zone.dart:701)
#47     _CustomZone.bindCallback. (dart:async/zone.dart:726)
#48     _rootRun (dart:async/zone.dart:892)
#49     _CustomZone.run (dart:async/zone.dart:793)
#50     _CustomZone.runGuarded (dart:async/zone.dart:701)
#51     _CustomZone.bindCallback. (dart:async/zone.dart:726)
#52     _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#53     _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#54     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#55     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
).

package:gcloud/src/db/model_db_impl.dart 126:7  fromDatastoreEntity
dart:core                                       List.forEach
package:gcloud/common.dart 58:23                _handlePage
dart:isolate                                    _RawReceivePortImpl._handleMessage
#7      _HashMap&&_LinkedHashMapMixin.forEach (dart:collection-patch/collection_patch.dart:967)
#8      _ModelDescription.decodeEntity (package:gcloud/src/db/model_db_impl.dart:415:41)
#9      fromDatastoreEntity (package:gcloud/src/db/model_db_impl.dart:124:43)
#10     _MapStream._handleData (dart:async/stream_pipe.dart:233)
#11     _handleData (dart:async/stream_pipe.dart:170)
#12     _rootRunUnary (dart:async/zone.dart:899)
#13     _CustomZone.runUnary (dart:async/zone.dart:801)
#14     _CustomZone.runUnaryGuarded (dart:async/zone.dart:709)
#15     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#16     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
#17     _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:587)
#18     _StreamController._add (dart:async/stream_controller.dart:462)
#19     add (dart:async/stream_controller.dart:410)
#20     List.forEach (dart:core-patch/growable_array.dart:254)
#21     _handlePage (package:gcloud/common.dart:58:23)
#22     _rootRunUnary (dart:async/zone.dart:899)
#23     _CustomZone.runUnary (dart:async/zone.dart:801)
#24     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:496)
#25     _Future._propagateToListeners (dart:async/future_impl.dart:579)
#26     _Future._complete (dart:async/future_impl.dart:325)
#27     Stream.fold. (dart:async/stream.dart:541)
#28     _rootRun (dart:async/zone.dart:888)
#29     _CustomZone.run (dart:async/zone.dart:793)
#30     _CustomZone.runGuarded (dart:async/zone.dart:701)
#31     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:390)
#32     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399)
#33     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:290)
#34     _ForwardingStream._handleDone (dart:async/stream_pipe.dart:110)
#35     _handleDone (dart:async/stream_pipe.dart:178)
#36     _rootRun (dart:async/zone.dart:888)
#37     _CustomZone.run (dart:async/zone.dart:793)
#38     _CustomZone.runGuarded (dart:async/zone.dart:701)
#39     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:390)
#40     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399)
#41     _DelayedDone.perform (dart:async/stream_impl.dart:614)
#42     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:711)
#43     _PendingEvents.schedule. (dart:async/stream_impl.dart:671)
#44     _rootRun (dart:async/zone.dart:888)
#45     _CustomZone.run (dart:async/zone.dart:793)
#46     _CustomZone.runGuarded (dart:async/zone.dart:701)
#47     _CustomZone.bindCallback. (dart:async/zone.dart:726)
#48     _rootRun (dart:async/zone.dart:892)
#49     _CustomZone.run (dart:async/zone.dart:793)
#50     _CustomZone.runGuarded (dart:async/zone.dart:701)
#51     _CustomZone.bindCallback. (dart:async/zone.dart:726)
#52     _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#53     _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#54     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#55     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
).

package:gcloud/src/db/model_db_impl.dart 126:7  fromDatastoreEntity
dart:core                                       List.forEach
package:gcloud/common.dart 58:23                _handlePage
dart:isolate                                    _RawReceivePortImpl._handleMessage
#28     _rootRun (dart:async/zone.dart:888)
#29     _CustomZone.run (dart:async/zone.dart:793)
#30     _CustomZone.runGuarded (dart:async/zone.dart:701)
#31     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:390)
#32     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399)
#33     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:290)
#34     _ForwardingStream._handleDone (dart:async/stream_pipe.dart:110)
#35     _handleDone (dart:async/stream_pipe.dart:178)
#36     _rootRun (dart:async/zone.dart:888)
#37     _CustomZone.run (dart:async/zone.dart:793)
#38     _CustomZone.runGuarded (dart:async/zone.dart:701)
#39     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:390)
#40     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399)
#41     _DelayedDone.perform (dart:async/stream_impl.dart:614)
#42     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:711)
#43     _PendingEvents.schedule. (dart:async/stream_impl.dart:671)
#44     _rootRun (dart:async/zone.dart:888)
#45     _CustomZone.run (dart:async/zone.dart:793)
#46     _CustomZone.runGuarded (dart:async/zone.dart:701)
#47     _CustomZone.bindCallback. (dart:async/zone.dart:726)
#48     _rootRun (dart:async/zone.dart:892)
#49     _CustomZone.run (dart:async/zone.dart:793)
#50     _CustomZone.runGuarded (dart:async/zone.dart:701)
#51     _CustomZone.bindCallback. (dart:async/zone.dart:726)
#52     _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#53     _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#54     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#55     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
).

package:gcloud/src/db/model_db_impl.dart 126:7  fromDatastoreEntity
dart:core                                       List.forEach
package:gcloud/common.dart 58:23                _handlePage
dart:isolate                                    _RawReceivePortImpl._handleMessage
#44     _rootRun (dart:async/zone.dart:888)
#45     _CustomZone.run (dart:async/zone.dart:793)
#46     _CustomZone.runGuarded (dart:async/zone.dart:701)
#47     _CustomZone.bindCallback. (dart:async/zone.dart:726)
#48     _rootRun (dart:async/zone.dart:892)
#49     _CustomZone.run (dart:async/zone.dart:793)
#50     _CustomZone.runGuarded (dart:async/zone.dart:701)
#51     _CustomZone.bindCallback. (dart:async/zone.dart:726)
#52     _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#53     _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#54     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#55     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
).

package:gcloud/src/db/model_db_impl.dart 126:7  fromDatastoreEntity
dart:core                                       List.forEach
package:gcloud/common.dart 58:23                _handlePage
dart:isolate                                    _RawReceivePortImpl._handleMessage
#48     _rootRun (dart:async/zone.dart:892)
#49     _CustomZone.run (dart:async/zone.dart:793)
#50     _CustomZone.runGuarded (dart:async/zone.dart:701)
#51     _CustomZone.bindCallback. (dart:async/zone.dart:726)
#52     _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#53     _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#54     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#55     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
).

package:gcloud/src/db/model_db_impl.dart 126:7  fromDatastoreEntity
dart:core                                       List.forEach
package:gcloud/common.dart 58:23                _handlePage
dart:isolate                                    _RawReceivePortImpl._handleMessage
#52     _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#53     _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#54     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#55     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
).

package:gcloud/src/db/model_db_impl.dart 126:7  fromDatastoreEntity
dart:core                                       List.forEach
package:gcloud/common.dart 58:23                _handlePage
dart:isolate                                    _RawReceivePortImpl._handleMessage

最佳答案

关于什么

gcloud preview app run app.yaml --clear-datastore

如已经在这里回答https://groups.google.com/a/dartlang.org/forum/#!topic/cloud/IyO-wSc__8I吗?

关于google-app-engine - 如何手动删除本地gcloud Dart DB?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27322221/

10-12 16:46