Cristian Garcia
Cristian Garcia

Reputation: 9859

How to manually delete local gcloud Dart DB?

I am running this simple code

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

and I am getting an error. When I query some types I don't get an error, with other I do. It seems that I've populated the DB and updated my types and now some query won't decode. I haven't tried using a filter, but if I use a lookup to some known entity it will work, however I was using this command to erase all the SampleTypes from my DB, but now I am stuck with some undesired damaged entities. How do I manually erase the DB? For starters, actually where does the Local DB reside?

Here is the actuall error

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

Upvotes: 1

Views: 54

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657871

What about

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

as already answered here https://groups.google.com/a/dartlang.org/forum/#!topic/cloud/IyO-wSc__8I ?

Upvotes: 1

Related Questions