Actually, I guess thinking about it they’re both as secure as each other. I was thinking of the token being leaked, and someone running any sql queries, but either way this version has get, set and delete which could be used maliciously just as the other one. I’m wrong, it wouldn’t be any less secure than this version.
This is meant to be simple for anyone to use, rather than people who know sql. I’ll gladly work on a full SQL (as I had planned to)
Alright cool, thanks for clarification! I’ll be on the look out for this and it would be cool to have one that could interface with basically any database a developer chooses in an all in one library.
Your problem with leaking tokens though is something you can’t possibly program to work around. I would just have ways of setting a new token or other. Sometimes being too security focused can lead to lack of features in a library, not that it’s a bad thing, but you shouldn’t limit yourself just because of user error.
The only database I’ve had past experience with is SQL (sqlite, mysql, etc) however I may look into other databases, and I do sometimes over focus on security especially ever since one of my projects got leaked a few years ago.
Considering the instability of Datastores ATM, an community managed open sourced database service with implemented REST apis and API key generation would be amazing. This would allow us to run our own databases for the times in which Datastores are experiencing issues and data still needs to be pushed/retrieved from somewhere.
SQL is quite universal in other databases so this shouldn’t be a problem. You can always message me on here if you need some help with NoSQL implemented if you plan to add that in as I may be willing to chip in some advice or knowledge. I’ve personally worked with MongoDB.
I’ve used MongoDB for a node server I had a while ago, wasn’t the most fun thing to work with, but if you’d like we could both help work on setting up an open sourced service (as Reinitialized suggested above) like this, but of course support multiple databases(with sql and nosql), if you would want to help out with that.
You should make a video for this. Would be MUCH easier to have a visual to follow by.
Mmmmm SQLite is definitely not scalable like Roblox’s Data Stores are. This looks more like a proof of concept or exercise project moreso than something you’d want to use in a large-scale production work.
I wasn’t thinking SQLite for this very reason (tho there are adaptions of SQLite such as this), but such a community supported project would be something I’d be very interested in.
What about something like Amazon Aurora?
For some reason I just have a hard time using data stores in general and think if they where designed more like databases they’d be eaiser to use.
Data stores already use AWS under the hood* - doing so would arguably be a waste of development time. But if you’re wanting to learn real world backend skills, I highly recommend giving it a shot. Databases are among the most common topic taught in CS and IT courses in college.
*This is a best guess for me, because big data store outages are often linked to AWS outages, not because of some public knowledge Roblox has released. I don’t have any insider knowledge on the technologies involved.
Yes, datastores on Roblox use Amazon DynamoDB under the hood. (Fast NoSQL Key-Value Database – Amazon DynamoDB – Amazon Web Services)
Looks like I can only store a value and not a table, is there anyway to store a table?
This is the test code I’ve ran.
local sqlModule = require(script.Parent.SqlModule)
game.Players.PlayerAdded:Connect(function(plr)
local ls = Instance.new("Folder")
ls.Name = "leaderstats"
local CoinsVal = 0
local DeathVal = 0
local canContinue = false
sqlModule:GetAsync("table2", plr.UserId, function(Success, Value, ServerResponse)
if (Success) then
-- Value is 'Table 1 key's value or nil, if it doesn't exist.
canContinue = true
if Value.Value ~= nil then
print("yues")
for i, v in pairs(Value.Value.value) do
print(i)
print(v)
end
--CoinsVal = Value.Value.value
end
print("Success")
else
plr:Kick("not success")
print("Not Success")
-- Value is the error message, however ServerResponse will contain more detailed information.
end
end)
repeat
wait(.25)
until canContinue == true
local C = Instance.new("IntValue", ls)
C.Name = "Coins"
print(CoinsVal)
C.Value = CoinsVal
print(C.Value)
C.Parent = ls
local D = Instance.new("IntValue", ls)
D.Name = "Deaths"
print(DeathVal)
D.Value = DeathVal
print(D.Value)
D.Parent = ls
ls.Parent = plr
wait(1)
spawn(function()
while wait(5) do
local data = {}
data["Coins"] = C.Value
data["Deaths"] = D.Value
sqlModule:PostAsync("table2", plr.UserId, data, function(Success, Value, ServerResponse)
if (Success) then
print("Success saved")
print(Value)
else
print(ServerResponse)
-- Value is Error Message, and third argument is Server Response. (Server Response gives more detailed information about an error)
end
end)
end
end)
while wait(1) do
D.Value = D.Value + 2
C.Value = C.Value + 1
end
end)
Hey there! I’m not sure I can recommend using this in a production game, it was designed for a niche usecase that rarely (if ever) comes up in game development and isn’t as reliable as datastores.
To answer your question, though: You’ll have to JSON Encode/Decode your table. This is pretty much what datastores do as well.
What do I include in the URL? I am super confused.
SQLModule = self.Modules.SQLModule
SQLModule:PostAsync("table2", "Pets", "Doggy", function(Success, Value, ServerResponse)
if (Success) then
warn("Worked")
else
warn("Failed :/")
print(ServerResponse)
end
end)
Keeps failing.
Remove the link from your post, make the glitch project private and reset your API key, please.
As for the URL, you’ll want to preview your app and copy the URL and paste it into the module’s config.
How many keys can this thing hold?
Is there a way to get all data?
You can use *
as the key to get all rows. Wouldn’t recommend doing this on any large tables.
SQLModule:PostAsync("table2", "Pets", "Doggy", function(Success, Value, ServerResponse)
if (Success) then
warn("Worked")
else
warn("Failed :/")
print(ServerResponse)
end
end)
SQLModule:GetAsync("table2", "*", function(Success, Value, ServerResponse)
if Success then
print(Value)
else
warn("Failed")
end
end)
--out put
{
["Success"] = true,
["ValueExists"] = true
} -