Questions tagged [querying]

516 questions
1
vote
1 answer

Automated scheduling based on availability

The data: Students which have varying availability at certain timestamps (hourly) throughout the week. The challenge: Creating a schedule based on the data above, where a single faculty member can meet with each student once that week, without any…
1
vote
0 answers

Firestore how to query documents chronologically

I understand that unlike Firebase Realtime DB, there isn't a built in method for querying Firestore documents chronologically. Other than adding a timestamp field to each document, is there another elegant way to achieve that? Apparently it isn't…
user6097845
  • 1,257
  • 1
  • 15
  • 33
1
vote
1 answer

'List object has no attribute' when querying 3 tables in database

I'm running a query and filtering results on 3 tables. I wrote the function below to perform this query, it looked like this: def bookshelf(): your_user = db.session.query(User).filter_by(email=session['email']).first().uid your_books =…
ARNON
  • 1,097
  • 1
  • 15
  • 33
1
vote
2 answers

How to filter an sqlalchemy query to all Parents w/o Children, and all Parents, who fall under conditions in a Flask Form

To begin with, I am very new to coding, so sorry in advance if it is not worth attention. I work with one to many relationship. Let's say I have a Parent class and a Child class defined as follows: class Parent(db.Model): __tablename__ =…
1
vote
2 answers

Compare Two Tables on Snowflake Where it Contains NULL Values

Hello everyone i am facing an issue, i.e Table T1 with schema ID TYPE MODEL_ID FREQ 1 Car 234 5 2 SUV 12 6 3 EV NULL NULL 4 HV NULL NULL TABLE T2 with schema and…
The_Third_Eye
  • 303
  • 3
  • 15
1
vote
1 answer

Firebase Firestore: How to update or access and update a field value, in a map, in an array, in a document, that is in a collection

Sorry for the long title. Visually and more precise, I would like to update the stock value after a payment is made. However, I get stuck after querying the entire document (e.g. the selected one with title sneakers). Is there a way to actually…
1
vote
2 answers

SQL Query Error: "sub-select returns 2 columns - expected 1" when trying to match either of two columns of subquery

When I write the following query: SELECT name FROM people WHERE phone_number IN (SELECT caller, receiver FROM phone_calls WHERE month = 7 AND day = 28 AND year = 2020 AND duration < 60); I get the following error: sub-select returns 2 columns -…
BroCode
  • 11
  • 5
1
vote
2 answers

Querying PostgreSQL JSONB column with varying types for data

As part of my schema in my PostgreSQL DB, currently running version 11, but willing to upgrade if it unblocks: I have a jsonb column data, which contains nested objects of various structure across the rows, which I don't have control over. Ex: row 1…
Norrec
  • 531
  • 4
  • 17
1
vote
1 answer

How to make the cell text label a specifc field in a document in a Firestore collection?

So my goal is to make the tableview cells in my dashboard populate with the specific field "event_name" of the documents in my Firestore collection. Here is my code that I came up with by using the Firebase docs. override func tableView(_ tableView:…
1
vote
1 answer

How to group data by summed amount less than x

Having an issue handling this in sql. Have a table of Check Amounts tied to customers. If I want to give them each unique numbers to be paid with, I cannot figure out how to do that with just an update statement and not going line by line(there is a…
GroGuru
  • 13
  • 3
1
vote
0 answers

Dynamic query in postgresql - Rolls rates of paydays

I run a query in postgresql to obtain the category of paydays in t+1 (f.e.02-28-2015) of a set of clients on a cut-off date - previous month t (f.e.01-31-2015). The result is satisfactory, however, if I wanted the rolls rate from January 2015 to…
Jean
  • 33
  • 7
1
vote
1 answer

Like button is working but not changing to Unlike in django

I've been trying to debug this issue for a day together with my expert coder but we were unable to identify the issue here. The like button works perfectly all right and I am able to query the total likes, but the Clap button does not change to…
user14919679
1
vote
1 answer

Creating a like button in django social media network

I'm new to django and I'm trying to create a like button for my blog posts. In my HomeFeed app However, I received this error when i click on the like button that i have created: ValueError invalid literal for int() with base 10: 'uien-jdhn-fds' I…
user14820658
1
vote
1 answer

Django query for matching 'cousin' objects (with same grandparent)

I am trying to write some validations on form input and need to check that the instance being created doesn't already exist under the same grandparent. The field I am validating against isn't a primary key as it can exist outside the 'family'. I…
fdeboo
  • 325
  • 1
  • 11
1
vote
2 answers

Error on MongoId query with any_of and conditions on a same attribute

When running the following MongoId query Project.any_of( { completed_at: nil}, { :completed_at.gte => @start_date} ) it produces this error: "This method is not prepared to handle key being a Key and serializer being not nil" I found the…
MegaTux
  • 1,591
  • 21
  • 26