Can I delete by attribute in Amazon SimpleDB without specifying an ItemName? - amazon-simpledb

Can I delete by attribute in SimpleDB without providing an ItemName parameter in the query string? The way I store my data is the item names are UUIDs, so I don't know the UUID of the data I want to delete. Is there a way to just specify an attribute and have it delete all items with that attribute?

There isn't a way to delete without the item name, but you can use a SELECT to get the items to be deleted:
select itemName() from MyDomain where MyAttribute = 'foo'

Related

Sql query for deleting a member by email in Umbraco8

Does anyone know of any query to delete a member in Umbraco 8 using sql. I had created a member which is corrupt now and creating errors in backoffice, so i want to delete it
I assigned the wrong email address to a new user, so I recreated the user with the correct email address and ended up with a disabled user which never is going to be used. I noticed that you can only "disable" users in the Umbraco back office.
I managed to delete the user via some SQL statements.
But because of some foreign keys, it took some extra steps.
1: Look up all users and thus their respective ID
SELECT * FROM [yourDBname].[dbo].[umbracoUser]
selection umbracoUser
For example, you want to delete the user with id 4. In your case the corrupted member.
2: Delete the user with the respective id from the umbracoUserLogin table
DELETE FROM [yourDBname].[dbo].[umbracoUserLogin] WHERE userId = 4
3: Do the same thing for the umbracoUser2UserGroup
DELETE FROM [yourDBname].[dbo].[umbracoUser2UserGroup] WHERE userId = 1
4: Lastly delete the user from the umbracoUser table
DELETE FROM [yourDBname].[dbo].[umbracoUser] WHERE id = 4
Because of the foreign keys, you should delete user rows in this order ([umbracoUserLogin] -> [umbracoUser2UserGroup] -> [umbracoUser]) otherwise, you get an error that you can't delete the row because of the foreign key.

CoreStore how to fetch or query object from unspecified dynamic object

enter code hereI read this guide which documented pretty good. I need to search through my database and get a record actually execute fetch or query.
Can I search through all records instead of specifying appropriate From clause.
For example
var undefinedObject = CoreStore.fetchAll(
From(GoThroughAllMyDataBaseEntities),
Where("%K == %#", "localId", "some string id")
)
print(undefinedObject.id) // as object will be undefined I need to figure out how to get id property from it.
Side note: all my entities are child objects of parent entity which has id property.
So let's say I have next entities in CoreData:
BaseEntity (which includes id)
Playlist
Song
in the code above I don't care which will be returned to me I just what to see one that matches this condition: Where("%K == %#", "localId", "some string id")
Also my localId property in each objects are very unique strings. They are extracted from NSManagedObjectID.
So there is no way have the same duplicated identifier localy in CoreData
If there is no way to do it, then I will need to loop all my Playlists and Songs records.
managedObjectContext.objectWithID(objectID) may not work thought in some cases as there is no guaranty that CoreData record has not been deleted and app recreated a copy of the same record, so physically a copy of record has another objectID address in CoreData, but still has localID property copied from other record.

When I try to save data to Firebase it only updates the existing data, Swift, Firebase

The way I set up my database structure was like this:
It starts with Lists then there is a child that shows the users UID then inside that there is one item.
The one item inside the UID gets updated every time I attempt to save new data. Instead of adding another item the same one just keeps changing. I was wondering how I could instead of update the same one item every time add more items.
The way that I save my data is with this line of code.
let user = FIRAuth.auth()?.currentUser
let item: String = self.ItemTextField.text!
self.ref.child("Lists").child(user!.uid).setValue(["Items": item])
More idiomatic is to store the list of items with so-called push ids:
Lists
twEymn...
-Km....: "Yoghurt"
You'd do this with:
self.ref.child("Lists").child(user!.uid).childByAutoId().setValue(item)
The childByAutoId() generates a unique, sequential ID. It's similar to an array index, but this one works reliably in multi-user environments and when users can be offline. Read this blog post about these so-called push ids.
Alternatively you can use the name of the item as the key (if the item has to be unique in the list):
Lists
twEymn...
"Yoghurt": true
In that case the code becomes:
self.ref.child("Lists").child(user!.uid).child(item).setValue(true)
One thing you'll note is that both of these approaches only deal with the newly added item, instead of the list of items as a whole. This is a general pattern you'll see when using Firebase. By isolating your modifications, your app will be more scalable without users getting into each other's way.
The problem is that you are setting a key-value pair ("Items" : item) so that each time it is updating the value for the same key. What you could do instead is ("Items" : [your array of items here]), which will update a list of items for the same key each time.
You could also fetch the current list of items, append your new item locally, and then update.

Overriding Id in JSON object from a mongodb

I am struggling to override the attribute name in one of my models.
I would like to return an object to the front end (via JSON) with a field called id.
Now the problem comes that there is a field called _id (generated by mongo), that I cannot seem to get rid of.
I can override the id fine but is still returned as _id.
[Object]
0: Object
$$hashKey: "007"
_id: 123
I would like it to be
[Object]
0: Object
$$hashKey: "007"
id: 123
I have tried many hash manipulations, reject, except, and looping over and constructing, but cannot simply rename the field, or remove it for that matter.
Thanks
The "_id" field is mandatory in MongoDB documents. The manual says:
If the document does not specify an _id field, then MongoDB will add
the _id field and assign a unique ObjectId for the document before
inserting. Most drivers create an ObjectId and insert the _id field,
but the mongod will create and populate the _id if the driver or
application does not.
So you won't be able to work your way around this one.
Easiest way was to override the as_json method and remove the hash there.
def as_json(*args)
super.tap { |hash| hash["id"] = hash.delete "_id" }
end

QBFC: How do I query the customners by accountnumber?

Since Intuit has broken the QBFC reference today, I have to ask a question that I could normally look up. (I do not know who to complain to).
I normally query by list_id like so:
ICustomerQuery CustomerQueryRq = requestMsgSet.AppendCustomerQueryRq();
CustomerQueryRq.ORCustomerListQuery.ListIDList.Add(qb_list_id);
Is there a way to query by AccountNumber?
Thanks!
No, QuickBooks does not support querying by the AccountNumber field.
This is old, but maybe worth adding.
Create a temp "cached" object, containing all the properties you want to search for. Them when launching, and whenever customer changes are made, cache a list of custom QBcustomersForSearch objects with only the properties that you would want to use for the search.
class qbCustomerForSearch
property email as string
property accountnumber as string
property whatever as string
property QBListId as string
end class
Cache / create a list of these objects when and as needed, and search your list. Once located in your list, use the listID to identify the QB customer.
Cheers

Resources