How to do "SQL queries" on Dfinity

Ah, now THAT is Good To Know :slight_smile:

And what about my question on this thing’s opinion on sites??

And btw, as I said before - if you guys’re doing something cool, and really breaking up BigTech, then God Bless You Guys :slight_smile: More power to you!

Ultimately the IC itself doesn’t have an opinion. But the people that own ICP have. There is an onchain government mechanism installed called ‘network nervous system’. If people participating in governance decided your site hurts the IC (and therefore the value of the tokens they stake) they can vote it off.

No, that’s Not Acceptable. As I just said in my other post, if we are to use Dfinity, they must change this - take that part of the code out of it.

I personally really like the idea of it, i think it makes the platform more appealing to enterprises in comparison to ethereums “code is law” approach (although i don’t know if that changes with eth 2.0) and also makes it possible to vote out stuff like child porn platforms and the like. I like the idea of a free, open internet but I also like the idea of being able to shape it as a community of users in consesus without central censorship. With technology available now adays there’s no need to go for an all or nothing approach. Why don’t you want the NNS?

4 Likes

No, I like the idea of all the porn stuff being kicked out too, but the sheer idea of someone else telling me what websites I can and can’t put up is Unthinkable!

Amazon can censor your content if it violates their policies.
China can censor your content if it violates their policies.
Twitter can censor your content if it violates their policies.

Users have no say.

Censorship in our current ecosystem is unilateral. Moving to a more democratic and fair model seems beneficial, no?

3 Likes

What is this “more democratic and fair model” of which you speak?

…and talking of which, how come ICANN doesn’t delete the DNS entry of porno people in the root servers? Anybody figure that out??

We don’t have details on how exactly governance works, but I would guess that ICP stakers can make proposals to eg. block a canister from being accessed. If some threshold of stakers vote in favor of this proposal, it is executed.

ICANN makes money from selling domains, their primary legal obligation is to store some identity information for each domain and make it publicly available. What the domain owners do with their domains is not of concern to ICANN.

“SQL queries” - Yes, that’s exactly what I expect to read in this thread. :crazy_face:

I like the way how this thread first starts off with a wasm sqlite db and then dives into politics about the point of ICP at all.

6 Likes

I have some minor updates to this now-stale thread. I still believe the original topic to be important, and a natural question to wonder when one finds either the Internet Computer or Motoko and wants to builld services with them.

First, the CanCan source code is now open and available to be cloned and forked:

GitHub - dfinity/cancan: A scalable video sharing service.

Regarding SQL and CanCan — the CanCan backend is an intentionally-simple Motoko canister (a single one, for now). To be as simple as possible, but no simpler, it does not support any query languages, per se, but it does represent (binary) relations and permit similar kinds of questions and answers to what one wants from a query language over tables.

In the Motoko CanCan backend, these relations represent mathematical relationships between users, their videos and their behavior.

For instance, this (binary) relation relates the “x follows Y” relation across users. It permits questions of the form “who follows X?” and “who is followed by Y?” (in other words, bidirectional questions).

Notably, a (general) binary relation is distinct from a 1-1 mapping, which has additional constraints, and a simpler representation. 1-1 mappings are commonly used to relate objects with their hashes. A hashtable represents one direction of such a mapping, but is not sufficient to represent a binary relation on its own. Most relations are not 1-1, such as who follows who in a social network. Under the hood, a general relation typically needs multiple inter-related maps (e.g., each a hashmap) to provide an efficient API for the (general) relation.

RelObj is an OO adaptation of Rel, which itself implements purely-functional binary relations using the base library’s Trie module. These modules are simple, but already give enough for all of the stateful relations in CanCan, including access control management and checks.

CanCan serves many other purposes than demonstrating data management patterns in canisters, including demonstrating a real professional mobile frontend, and a social media Dapp, with rewards system and distributed moderation story, etc.

To isolate the data management patterns from the rest of the project and focus on them, I recently distilled those of the backend architecture from the rest of the CanCan story, and created a separate open source project, Candid Spaces.

Unlike CanCan, which shows an end-user facing Dapp, Candid Spaces is aimed at developers. It aims to host data lakes of candid data, for general purposes yet to be determined, but initially to benefit developers that want to share IC data from their canisters, log what their canisters do as they do it, or back it up their bulk state into a separate, searchable (general) data store, for candid data.

It is a work in progress, but shows another instance of the CanCan architecture, for another use case.

Happy to answer questions here, or in other threads on the forum.

6 Likes

I would recommend giving Motoko a chance before bashing it, if your looking for more of a high level technical explanation of ‘why’, this video featuring Andreas Rossberg [one of the key developers of Web Assembly] that is hidden 2hrs and 23 minutes into the Genesis launch event is the most concise I have seen

On the conceptual level, it aims to bring all the functionality and the canister-as-an-actor model to the coder as concisely as possible…

… to understand why this is such a powerful concept running on the Internet Computers network of distributed nodes you should read up on the Actor Model and some of the original manifestations of parallel computing that inspired it…

1 Like

… web Assembly is a compilation target with better/more performant access to low-level functionality of the device than is available with javascript, … it allows for more native-like apps to run in browsers without having to install anything.

Motoku is there to abstract away all the boilerplate that you would have if you used something like Rust… Using it, Can Can was written in ~ 1000 lines of code.

Next little chunk of money I make where I can escape the day to day rat race for a bit I plan on taking some time to try and build a little mock social media platform on it

1 Like

@alexa.smith I’m just seeing the reference to the (very good) data structures course (yeah, 1 year late). This is literally the first thing I would have wanted to study after “hello world”, and yet there’s nothing about this anywhere on sdk.dfinity.org . If it’s there it’s well hidden. Can this be given more prominence? The issue of “how best to migrate all my SQL to Motoko?” is fundamental to thousands of devs…

1 Like

@wole thanks for flagging this, I’ve sent along to the team. We’re in the process of making some significant updates to our dev docs and will work to incorporate this feedback. Thanks again!