Working with a dataset on firebase sending via python
I was testing a dataset I have on Firebase.
Using the this instruction
result = firebase.get('/Lot',"I") #THIS PULLS THE DATASET FROM FIREBASE
When I use the the firebase.get instruction in python I get the following.
runfile('C:/Users/Maint.Tech/parking_app/firebase_test.py',
wdir='C:/Users/Maint.Tech/parking_app')
[None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1,
1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0,
1, 0, 1, 1, 1, 0]
What is "None"? When I manipulate the numbers after "none" everything reflects in dataset correctly.- From python I am trying to take a array in python and send this via json list. How would I set up python array to reflect the correct structure to send to firebase? This is the instruction I have sent that updates the dataset correctly. Just need to figure out how to write the python right..
send_data = firebase.put('/Lot','I',[None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0])
Thank you.
python firebase firebase-realtime-database
add a comment |
I was testing a dataset I have on Firebase.
Using the this instruction
result = firebase.get('/Lot',"I") #THIS PULLS THE DATASET FROM FIREBASE
When I use the the firebase.get instruction in python I get the following.
runfile('C:/Users/Maint.Tech/parking_app/firebase_test.py',
wdir='C:/Users/Maint.Tech/parking_app')
[None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1,
1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0,
1, 0, 1, 1, 1, 0]
What is "None"? When I manipulate the numbers after "none" everything reflects in dataset correctly.- From python I am trying to take a array in python and send this via json list. How would I set up python array to reflect the correct structure to send to firebase? This is the instruction I have sent that updates the dataset correctly. Just need to figure out how to write the python right..
send_data = firebase.put('/Lot','I',[None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0])
Thank you.
python firebase firebase-realtime-database
add a comment |
I was testing a dataset I have on Firebase.
Using the this instruction
result = firebase.get('/Lot',"I") #THIS PULLS THE DATASET FROM FIREBASE
When I use the the firebase.get instruction in python I get the following.
runfile('C:/Users/Maint.Tech/parking_app/firebase_test.py',
wdir='C:/Users/Maint.Tech/parking_app')
[None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1,
1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0,
1, 0, 1, 1, 1, 0]
What is "None"? When I manipulate the numbers after "none" everything reflects in dataset correctly.- From python I am trying to take a array in python and send this via json list. How would I set up python array to reflect the correct structure to send to firebase? This is the instruction I have sent that updates the dataset correctly. Just need to figure out how to write the python right..
send_data = firebase.put('/Lot','I',[None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0])
Thank you.
python firebase firebase-realtime-database
I was testing a dataset I have on Firebase.
Using the this instruction
result = firebase.get('/Lot',"I") #THIS PULLS THE DATASET FROM FIREBASE
When I use the the firebase.get instruction in python I get the following.
runfile('C:/Users/Maint.Tech/parking_app/firebase_test.py',
wdir='C:/Users/Maint.Tech/parking_app')
[None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1,
1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0,
1, 0, 1, 1, 1, 0]
What is "None"? When I manipulate the numbers after "none" everything reflects in dataset correctly.- From python I am trying to take a array in python and send this via json list. How would I set up python array to reflect the correct structure to send to firebase? This is the instruction I have sent that updates the dataset correctly. Just need to figure out how to write the python right..
send_data = firebase.put('/Lot','I',[None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0])
Thank you.
python firebase firebase-realtime-database
python firebase firebase-realtime-database
edited Nov 19 '18 at 15:16
Frank van Puffelen
231k28378402
231k28378402
asked Nov 19 '18 at 14:02
Brooks NelsonBrooks Nelson
113
113
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Firebase doesn't natively store arrays. When you send it an array, it stores the items from that array in number properties instead.
So if you store the follow array in JavaScript:
ref.set([ first, second, third ]);
Firebase actually stores it as:
{
"0": "first",
"1": "second",
"2": "third"
}
Now if you remove the first item from the database, and read the result back into an array in JavaScript, you get:
[ undefined, "second", "third" ]
And that last one seems very close to what you have in your Python script.
But in this case that's all just background information. It looks like you're actually sending the None
yourself in the put
to Firebase. If you don't want None
in there, don't send it, and instead do:
send_data = firebase.put('/Lot','I',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0])
Thanks. I did not even think.. "Try taking it out." I took it out an sure enough it updated fine.
– Brooks Nelson
Nov 19 '18 at 15:32
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376310%2fworking-with-a-dataset-on-firebase-sending-via-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Firebase doesn't natively store arrays. When you send it an array, it stores the items from that array in number properties instead.
So if you store the follow array in JavaScript:
ref.set([ first, second, third ]);
Firebase actually stores it as:
{
"0": "first",
"1": "second",
"2": "third"
}
Now if you remove the first item from the database, and read the result back into an array in JavaScript, you get:
[ undefined, "second", "third" ]
And that last one seems very close to what you have in your Python script.
But in this case that's all just background information. It looks like you're actually sending the None
yourself in the put
to Firebase. If you don't want None
in there, don't send it, and instead do:
send_data = firebase.put('/Lot','I',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0])
Thanks. I did not even think.. "Try taking it out." I took it out an sure enough it updated fine.
– Brooks Nelson
Nov 19 '18 at 15:32
add a comment |
Firebase doesn't natively store arrays. When you send it an array, it stores the items from that array in number properties instead.
So if you store the follow array in JavaScript:
ref.set([ first, second, third ]);
Firebase actually stores it as:
{
"0": "first",
"1": "second",
"2": "third"
}
Now if you remove the first item from the database, and read the result back into an array in JavaScript, you get:
[ undefined, "second", "third" ]
And that last one seems very close to what you have in your Python script.
But in this case that's all just background information. It looks like you're actually sending the None
yourself in the put
to Firebase. If you don't want None
in there, don't send it, and instead do:
send_data = firebase.put('/Lot','I',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0])
Thanks. I did not even think.. "Try taking it out." I took it out an sure enough it updated fine.
– Brooks Nelson
Nov 19 '18 at 15:32
add a comment |
Firebase doesn't natively store arrays. When you send it an array, it stores the items from that array in number properties instead.
So if you store the follow array in JavaScript:
ref.set([ first, second, third ]);
Firebase actually stores it as:
{
"0": "first",
"1": "second",
"2": "third"
}
Now if you remove the first item from the database, and read the result back into an array in JavaScript, you get:
[ undefined, "second", "third" ]
And that last one seems very close to what you have in your Python script.
But in this case that's all just background information. It looks like you're actually sending the None
yourself in the put
to Firebase. If you don't want None
in there, don't send it, and instead do:
send_data = firebase.put('/Lot','I',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0])
Firebase doesn't natively store arrays. When you send it an array, it stores the items from that array in number properties instead.
So if you store the follow array in JavaScript:
ref.set([ first, second, third ]);
Firebase actually stores it as:
{
"0": "first",
"1": "second",
"2": "third"
}
Now if you remove the first item from the database, and read the result back into an array in JavaScript, you get:
[ undefined, "second", "third" ]
And that last one seems very close to what you have in your Python script.
But in this case that's all just background information. It looks like you're actually sending the None
yourself in the put
to Firebase. If you don't want None
in there, don't send it, and instead do:
send_data = firebase.put('/Lot','I',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0])
answered Nov 19 '18 at 15:20
Frank van PuffelenFrank van Puffelen
231k28378402
231k28378402
Thanks. I did not even think.. "Try taking it out." I took it out an sure enough it updated fine.
– Brooks Nelson
Nov 19 '18 at 15:32
add a comment |
Thanks. I did not even think.. "Try taking it out." I took it out an sure enough it updated fine.
– Brooks Nelson
Nov 19 '18 at 15:32
Thanks. I did not even think.. "Try taking it out." I took it out an sure enough it updated fine.
– Brooks Nelson
Nov 19 '18 at 15:32
Thanks. I did not even think.. "Try taking it out." I took it out an sure enough it updated fine.
– Brooks Nelson
Nov 19 '18 at 15:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376310%2fworking-with-a-dataset-on-firebase-sending-via-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown