Firestore & Python, updating a specific object within an array - python

Below is an example of the data that I have within my Firestore Application.
I am looking to update the "prices" object using python, is this a possibility? I am finding it increasingly hard to get all the way to the data.
I don't want you to code this for me, i'm merly asking if it is possible and just some quick guidance on how to achieve it.
My api will fetch prices, then find the "ID" of the specific conditions which is stored in the "id" field within the condtion array, if will then update the "prices" object of that found id.
Like I said, is this possible? And a few pointers on how to achieve this would be great!
Kind Regards,
Josh

Updating just one field of an array item is not possible.
The most you could do would be to update only an entire array item. You can do this with arrayRemove() and arrayUnion(). More info in the docs

Related

Is there a way to use the Wufoo API to get fields by a specific Entry ID

I am trying to access fields from a specific Wufoo submission by the entryID.
I see in the documentation where I can access entries via iteration of a specific form, but I want to just access one of those entries without having to loop over the entire amount of entries. Is there a way to do that?
GET http://{subdomain}.wufoo.com/api/v3/forms/{identifier}.{format}
EDIT
I also found this GET:
response = urllib2.urlopen(base_url+'forms/s1afea8b1vk0jf7/entries.json?sort=EntryId&sortDirection=DESC')
It looks like I could sort by EntryID, so I am experimenting, but any thoughts are welcome.

Tkinter - Data Storing and Manipulating With Comboboxes

I'm still very new at programing and I'm sitting with a mental block as to how I can overcome my issue. Some advice or pointers would be appreciated.
I am trying to build a pilots logbook.
Looking at the aircraft, you are supposed to log the following data for each flight:
Type of aircraft
If the type is a single- or multi engine aircraft
Registration of aircraft.
For instance:
Boeing 747
Multi engine
N1234ABC
All Boeing 747s will of course be classified as multi engine aircraft, but you may fly more than one registation of the type.
Now, using tkinter, and to avoid mistakes, 2 comboboxes for the above (multi/single should be known in background for selected type), how do I connect them?
So first combobox will be 'type' and then the next ('registration') must only show registrations for the specific type.
My idea was something like below:
aircrafts = {
{'Boeing747': ['ME', 'N123ABC', 'N111AAA', 'N462AUF'},
{'type2': [se, reg1, reg2, reg3},
{'type3': [me, reg1, reg2, reg3, reg4}
}
When the data gets logged, it can use the first item in the list to find out if it is single/multi engined, to ensure the hours flown gets logged under the correct column.
Am I planning in the right direction, or is there an easier/better way of doing this?
And I think I have a solution.
Two separate dictionaries.
One for all single engined aircraft, and one for multi engined aircraft.
Then, I can combine the keys of borh in a list for combobox values. By aelecting a value, the dunction can search both dictionaries for it, to find the relevant registrations.
Am I right?

Rethinkdb Python - Changes: How to return only the field that changed?

How can I use the changefeed in rethink to receive only the field that changed instead of all the available fields?
If this is not possible, what is the most optimal way python-wise to find the modified field?
Thanks
If you know before, which fields are going to change you can specify your selection that way with e.g. pluck/filter. Otherwise you can't. The changes will be served including the whole document as:
{
"old_val":"{}"
"new_val":"{}"
}
On the topic how to compare those json documents in your changefeed, you will find plenty solutions e.g:
Comparing python dictionaries and find diffrence of the two

how to get all the key from one bucket in couchbase?

Using Python SDK, could not find how to get all the keys from one bucket
in couchbase.
Docs reference:
http://docs.couchbase.com/sdk-api/couchbase-python-client-2.2.0/api/couchbase.html#item-api-methods
https://github.com/couchbase/couchbase-python-client/tree/master/examples
https://stackoverflow.com/questions/27040667/how-to-get-all-keys-from-couchbase
Is there a simple way to get all the keys ?
I'm a little concerned as to why you would want every single key. The number of documents can get very large, and I can't think of a good reason to want every single key.
That being said, here are a couple of ways to do it in Couchbase:
N1QL. First, create a primary index (CREATE PRIMARY INDEX ON bucketname), then select the keys: SELECT META().id FROM bucketname; In Python, you can use N1QLQuery and N1QLRequest to execute these.
Create a map/reduce view index. Literally the default map function when you create a new map/reduce view index is exactly that: function (doc, meta) { emit(meta.id, null); }. In Python, use the View class.
You don't need Python to do these things, by the way, but you can use it if you'd like. Check out the documentation for the Couchbase Python SDK for more information.
I'm a little concerned as to why you would want every single key. The number of documents can get very large, and I can't think of a good reason to want every single key.
There is a document for every customer with the key being the username for the customer. That username is only held as a one-way hash (along with the password) for authentication. It is not stored in its original form or in a form from which the original can be recovered. It's not feasible to ask the 100 million customers to provide their userids. This came from an actual customer on #seteam.

Quickly implement a sortable table of objects in Django

Hey all. I have a question on how to implement the following with Django. I'd like to display a tabular view of my objects with each column corresponding to a particular model field. I'd like to be able to have the user sort the columns or search through all of them. Basically just like the admin, but client facing and read-only. It's simple, but I was wondering if there was a way I could implement this without having to write all that logic from scratch.
Alex Gaynor's django-filter may be what you want.
Depending on how much you wanted to work with it, Yahoo YUI's DataTable control is pretty easy to get working with a JSON data source. See http://developer.yahoo.com/yui/datatable/

Categories