 We have all kinds of technical problems today, but that's the fun with EuroPython. And one of the problems that you can have is like a webcam not working. So I'm spotlighting our next speaker already so that you can see Choke. Hello. Welcome to EuroPython. Thank you. So you're a developer relations lead at Terminus DB and you've prepared a talk for us today. Yes, that's my full-time job, yes. Yes, you're full-time job. I do have a job, yes. That's great. You're calling in from London, right? Yes, that's correct. I mean, London. And let's see, hopefully. I can see you now actually, yeah. Yeah, the cameras, this is the fun thing. Things break sometimes if you run this on your own home hardware. So it's great that the camera is back. I have no idea what went wrong, but I would say it's better if it breaks on my side than on yours. So if you would like to, please share your screen and then we'll get on with the conference. Okay, so I would just get started because we are running a little bit later already. So yeah, so welcome to my talk and I always, always have this habit of putting my, oops, actually the slides is, well, I just thought my first typo is wrong is slides.com slash check thing and then slash B-Python next. So it's not a bitly link. So, but anyway, I would share it afterwards. So yeah, I share my slides on how to be pythonic, design a query language in Python. And those are my social media link below. So you could actually find me anywhere. So I'm Cherk, I love open source projects. So I've been working in a lot of open source projects and recently, not recently, but like, I mean, like my food time job is working with TerminusDB. We are an open source graph database that you know, you can work it like Git. So you can share, you can, you know, collaborate with people, you can do branching and merging and all those kind of stuff that you do with Git, but in a graph database. So I also organize a lot of different, you know, events including EuroPython here and also PyDataGlobal, I've talked about it yesterday in my licensing talk, you know, CFP is closing soon and we have pyjamas towards the end of this year. So yeah, contact me if you're interested in more this kind of conference. And yeah, I will spend too much time on this one, but to tell you this here, but please, please get in touch if you're interested in submitting to PyDataGlobal or, you know, want to get involved in pyjamas. Also I stream on Twitch, like yesterday, now I mean he's in her, sorry, in her keynote, then she put like a screenshot of my Twitch at the background and I was like, whoa, okay. So yeah, if you want to watch more of my tutorial, just find me on Twitch. I'm online usually four times a week and there will be tutorials all in Python and also other, you know, channel, like other programs that I would talk about things. Well, I am really like, you know, really catch my tongue today because I think I just woke up actually. So first of all, I would love to have this poll. So if you're watching right now, so this is, you know, you can use your phone, you can just take a capture of this QR code or go to this link here and do the poll and I am starting it right now actually. So I go there and so yeah, I would just want to ask the questions that like what does Python mean? Is it a thing? So yeah, like I would just give you like maybe a few seconds to do it because I don't have like, I have a short talk today. So they're like, I can see how many of you have voters only three, come on, let's do it. Yeah, maybe I'll give you a little bit more time for the first one because it's difficult to go to the link and stuff. So yeah, and because I will show the results. I will show the results. So please participate. And that's, that's why like we do it live here. So do you think Python is a thing? Do you think like, you know, it's actually a thing or people just like, you know, try to, you know, be smart or, you know. So yeah, I can see the vote is going up. That's good. That's good. Love seeing all of you participating. So let's go to the result and have a look. So, oh, I'm polling myself. No, this is not supposed to be. So give me one sec. I gotta quickly go to the result here. I don't know why it's like showing me, yeah. Okay. So, and I would just give a pause here. And most of you actually said that it's actually 23 of you said that it's, yeah, sure, it's a thing. So yeah, well, this is like even more than last time I did this poll. Like people really think that Python is a thing. And so I'm very interested because I've been using Python for a while and this really bugs me. And I go to look it up online, you know, ask Google or anything. So I found this on Stack Overflow. This is one of my favorite websites. And someone said that Python, it means that the code just doesn't get the syntax right. So it just doesn't execute, but it's, you know, using Python as a way that is conventionally like people agree to use it that way. So it's accepted by the Python community. I think it's a very good way of putting it. So that's why I put it here. And so in a nutshell, I would say that it's more like an artistic thing. So it's not a right or wrong. It's more like whether it's beautiful, it's appealing, it's good looking. But just beauty is not a right or wrong, right? Because beauty is at the beholder's eye. You know, you can think that this, you know, this doc is cute, but someone may say that, oh no, this doc is scary, you know? So yeah, like everybody can have different opinions on it. But there is a general, general kind of agreement on some standards. For example, like we have, you know, beauty queen contest and people would, you know, pick one that, you know, that they think that could represent a country that is our standard of beauty and things like that. So that's something that I ask a lot when I would just start a Python when I was data scientist, I was, yeah, I start Python because, you know, of data science and I use Panda a lot. And I was like, why I have to do things this way? Why I can't just write a folder to do it? Well, you could write a folder to do it, but you're not making use of the advantage of using Pandas because Pandas, you know, is very optimized. At the back end is used NumPy and NumPy is super optimized. So if you do the things, like for example, aggregation using, you know, their intended way to do it rather than just doing it in a folder that is so much faster. And also, you know, this is not Python. I hope you notice. This is Java, I think, or JavaScript. Things like that, yeah, I can't really tell. But you can tell from like the semicolon and things like this is not Python. But, you know, well, you could, you know, put it like in a very simple for loop in Python. This is something I came across a lot when I am doing my journey of, you know, I will explain later, but it's a spoiler that I translate a lot of code from JavaScript to Python for the TerminusDB client. And some of the things that I see all the time is that JavaScript, you will have a for loop, like that one, the one on top. And it's really complicated and it could become really big and very difficult to see because, you know, there's a lot of dictionary and like traveling fluid, you know, well, it's a JSON in JavaScript. But like traveling fluid with an index is an extra layer of complexity. I'm with Python, you know, just loop through all the items, that's amazing. And of course, like if it's something very simple, you can even make it into one line, use, you know, a list composition and things like that to generate it with just one line. That's Pythonic, that's amazing. So, and I think that like a lot about Python is that, you know, when you check whether something is in a list, you can just like check it, whether that's in the list, like rather than like going for it, like or using index of like the JavaScript. So that's really great. So before I talk about how we decided query language in Python, I want to ask a question. So again, go to your polling and I'm starting the next question right now. I hope that is working. And so let me have a look at this one. And it's a bit difficult for me to switch between all these tabs because the zoom thing is on the way, okay? So this is done. So let's move on to the next one. So how can I move on to the next one? Yeah, I think I just like the next one. And do you like SQL? So I have started a poll. So you should be able to vote it. I would go, do you still have the link? Okay, I'll just go back to the link here. So in case you just join the middle, okay? So please vote whether you like SQL or not. Yeah, I'm hiding the result because I don't want you to be affected by it. So yeah, well, I hope you kind of, you have used SQL before. It's the most, you know, most common, you know, query language right now. And I don't know how many of you are using, you know, dealing with data or you don't have to be a data scientist to dealing with data. Like if you, for example, if you build a backend like a database for your, let's say, Django app, then maybe you also have to deal with the data. So I don't know whether you like writing SQL in like in Python. I mean, you could, you know, you SQL Alchemy to execute SQL in Python. So I don't know whether it's your thing. So okay, I think the time's up. So sorry, it's a bit random here because I have to really like make use of my time. And okay, so it's kind of not that diverse. It's like more or less like, you know, 50, 50, but you know, there's a little bit more people saying that they are not a fan, which is surprising because last time I did it, it's like a lot of people say that they love it. Last time I did it in Py Amsterdam. So yeah, I don't know. Like maybe the composition of people joining is a little bit different. So it all started when I've become a developer advocate of Terminus DB. So what is Terminus DB? I just wanted to spend a few, you know, just quick introduction of it. So this is a table. This is, you know, you have seen it all the time. This is, you know, something that, you know, you came across quite a lot, especially in relational database. So here, when you look at it, you'll be like, okay, I see some people's name. I see some dates of birth. So maybe it's a list of people, but well, it takes you a while to understand what is mother and father? Well, it's mother and father, but like it's number, it's not a name. So what's going on here? And then you look at the beginning of this table and say, like you see like person ID. Also, maybe I should map it, map the mother and father to the person's ID. I joined the table again, joining a table, common thing, joining it again. And then I would get the answer that I want. Maybe I can find out who is John's mother or John's grandmother, you know? But what if like, I just like store data like this, like rather than I don't have to mentally join things, because, you know, this one is more obvious. You don't need to spend time on like figuring it out. We just look at it. It's a family tree. It's family tree. And then like it's color coded as well, like, you know, it's very easy to see Mary's John's mother and Patricia and Sally's John's grandmother. You don't have to do the joins. And in query language, it's like, this is how you find the answer in Seco. You have to, you know, do a select and then, you know, select and then do a join. And I'm not a big fan of that because sometimes very like, again, it's like, why I can't do it like in the program or why I have to join this table again, aggregate and join it back to itself again is a nightmare. It could easily become like a thousand line of Seco. It's like, what? But like, what if like we write things like that? So this is what is happening in Terminus DB that like when I joined, they have this JavaScript client that they have a query language called Waco.js. So this is, well, this is not Python, this is JavaScript. We can see, oh, there's no semicolon here, but it's still, you know, this is JavaScript. And so I just copied from that example. But, you know, it's again, you know, this is query language in Waco and then you just, because everything is stored in a graph, remember it's a family tree. So everything is just a relationship, it's a triple. So you can see that like a person and the relationship mother and it gives me the mother ID. And you can find, like do it one more level up. You can like have mother ID, mother and then that will be grandmother ID. And then in between, I just like kind of, I need to give out the name rather than ID. So that's why I have four kind of things here. But, you know, in theory it's just two. It's just I need the name, so I kind of make it more. And so yeah, I was thinking that's really nice. That's really nice that you can kind of just, you know, build a query, like rather than SQL, you have to write all this joint thing and then make it into a string and put it in your script. I want to use, you know, do something like that in Python. I want to just like, you know, a query is just a Python object and building things and, you know, some of them are a little bit chaining or like putting in parameters and construct your query in a Pythonic way. So, well, let's create Wacool Pi. Let's, you know, make those JavaScript that awesomeness into Python awesomeness. I just, yeah, I want to make it a query language for Python Easter for data scientists. And the team say, yes, like wonderful, wonderful. So we can do it now. So what is Wacool Pi? So first of all, it's something like when I was planning it, I was like, okay, it must be something that you can pip install, right? Because, well, otherwise, you know, it's not as convenient because the PyPI is great, you know, when people can, you know, just install stuff very easily. And also, well, not, well, it's like a few months ago, we added this data frame, you know, it's extra, you know, data frame option there. So if you install it, it will install some pandas. So it actually lets you talk with, you know, pandas. So when you get a result back from your query, then actually it will just build a data frame for you rather than like, you know, it's like natively it will be a dictionary because it is JSON. And then when it comes back, it will become a dictionary, but this will become a pandas, it's afraid. We all, we all love pandas, you know. So, and also, you know, yeah. So that's how you call it, just dump the result in it. So that's great. Okay, so the query, actually, this is actually, well, you do everything in Python. You can create a database in Python. You can connect to any database in Python. You can delete it in Python if you want to. You can build a schema because like it's a graph database. You can build a schema graph with Python. You can, you know, load in the data in Python. You can, you know, query and get back the result in Python and even in pandas data frame. So it's all Python, it's just a Python script. You can do everything like this. Rather than, you know, this is the raw format of Racko. It's just a JSON that lets the front end talk to the back end. So no one wants to code like this. Like, yeah. So without that, you know, Racko Py, so well, you have to, you know, really construct this. So it's like SQL. You construct the query like as a string and send it, you know, to your database. But because the portal core for TerminalDB is JSON. So if you don't have the, if you don't have the Python client, you have to construct this JSON yourself and use, you know, and parse it, you know, maybe, well, we have APIs or maybe you can just use request to send it, you know, this not nice. And now, because recently we have also launched this branching, merging and all this abilities. It's not in the slides because it's very new. It's the, you know, branching, merging and cloning all this stuff. So now you can even do it with the Python client. So you can fully control, you know, version control your database with just Python script. So that's what we want to do. And so again, like this is something new that I recently think that it would be great. Just last time I gave this talk at the Pi Amsterdam and that people was like, someone said, you know, well, people prefer, you know, to have this, you know, label and description, putting it as a parameter rather than, you know, just a change. So this is how Waco.js was like. It's just chaining a bunch of calls, a bunch of methods. And then it will just build a query at the end. So afterwards this object will be the query that you want. But I think it's like maybe in Python, people don't like this as much. I don't know. You have to show me. I will have another poll for that. So I created this. And now you can actually do both, but I just want to know what do people prefer? Like if you are given these two options, if you are writing your TermsDB query, will you write it in a chaining pathway more like what we used to have and or this new way of like putting label in there. So I'll start the poll now. And so you can go to the link there and start. Let me see. Yeah. So please answer the questions. And yeah, I hope this is working or I don't have to click this. Sorry, let me have a look. No, yeah, it's not there yet. So let me move on. And yeah, you should be able to vote now. Yes. Yeah. Right. I tried right. So yeah. Oh, I supposed to hide it. But like you don't see which one is which. So it doesn't matter. Just pick which one you prefer. And we would have a look at the result. And yeah. So, yep. So I think it's the last chance like to vote. I really, this is the question that I really want to know like what do people prefer? Because we, well, you have to do both but I just want to see like where the, yeah, what if people still prefer the multi-parameter way or maybe people think that Cheney is also beautiful. I want to know which one is more pythonic. So yeah. Okay. So I should really have a pause here. Okay. So people prefer multi-parameters. So that's great. I was not guessing wrong. So that's good. That, you know, that's really, really good. And yeah. So now you can do this. We added this method. So I hope this is a good news. So Python is there who prefer like that one rather than the other. So I would tell you also some of the design challenges that I have. Anybody spot anything wrong here? I know that you can't answer me and I'm not looking at the chat in the track. But if someone's spotting it was wrong and I'm trying to look at the chat right now, but yeah, you can say it there and where the people can. So yeah. What's going wrong here is that Python, you can't have a method like this. You can't have a method like this. So, and is a keyword. So we can't have a method using just n. I know that if you're, you know, a Python guru, maybe it's a way that you could do that, maybe change the interpreter or something. I don't know. But for me, I was like, oh no, you can't. Yeah, somebody spotted the n in the chat. Great. So yeah. So that's why I make it a Waco n as a Waco n. But that's horrible. It's super long. You can see that like compared to the JavaScript. This is super long and it's very cranky. I don't like it. I don't like it. It's like a lot of things to type. I'm horrible with typing. So just like recently in the newest version, I added the plus operator. So the operator overload is really quite nice in Python. All my colleague was like, oh yeah, yeah, you can do it in Python. Well, they didn't think about that. But like, well, I didn't think about that myself as well. Someone suggested to me last time in Py Amsterdam. I think that's why I love giving this talk and people can suggest to me what they think that is good. So I could, you know, I could add that in. So the plus operator, thank you for letting me know that. Actually, I was having this like kind of, oh, maybe I can make it more like, you know, more native Python. But I think some operator thing like overload there. But someone mentioned it. I was like, yeah, then let's do it. That's really good. I still have problem with or not as from. They are all like keywords in Python. So if you think of any other like elegant way to do it, please let me know. So yeah, now you can like just, you know, add all these queries together. You will see that when you use, well, I encourage you to try this out. But like when you see that, like, it's actually good to have a plus because you would join all these query together quite often. So I'm looking into the future, what we want to do. And well, this is, this is a, a pandas data frame. And, you know, I suppose in Jupyter Notebook, I have done this tutorial in a Jupyter Notebook and this is the result that I got back. And this is, you know, I've talked about that we use the data frame function that we could put it into a data frame like this. And what if we have a graph visualization in Jupyter Notebook? I know that, you know, recently I discovered that using Bokeh, you could have interactive graph and also, but Bokeh, you can also use it in, you know, to use it with network X to make a graph visualization, a network graph visualization. But that's not very nice. There's no label there. It's a bit like difficult to use. So I'm thinking like having a nice graph visualization will be great. So loading data from data frame, well, we, because now we just like, we just turn the result back into the data frame, but we can't just like put a data frame and then just push it as a knowledge graph. That requires a little bit of guessing because like it's easy to see like how the result can come back as a table, but it's difficult to see like how your table could map properly into an knowledge graph. That's need a lot of, you know, a bit of work. And we wanna see our clients and I'm thinking like, well, it's easy, we just be with click. But the only problem is that like now because we will have hub, which is like kind of a lock-in thing. So there's some like JWT of all kind of communication through the server. So that need to be solved. We are still working on it. And I want more of fail-proof checks that, you know, I want to, you know, to warn the user before we push things to the backend because it may be a bit query and there will be something for, you know, a typo or something for a tree field, but like it will still go to the backend and it's just waste some time that it will turn out to be a bit query. And so, yeah, maybe checking. Also like checking the version, sometimes, you know, like people are not using the same version of the database and the Python client. If they are not compatible, we should warn them. So yeah, I think that's it. I still have a few minutes for Q&A as I see there's some questions coming in. So join our sprint tomorrow. We will have the sprint. We'll work on the Python clients. This is my baby. So please come and help me. And also we have, you know, the world of WacoCraft is my, one of my tutorials every Friday at 5 p.m. UK time. A CST will be 6 p.m. So this week, I think you would prefer Guido's Q&A, but, you know, you can join me next week. So I will teach you how to use it, how to use WacoPie. And also, you know, follow us on Twitter, you know, we have a Discord community. So join us at the Discord community. And so I will leave you with the slides and questions. Okay, first, thank you very much for this talk. And there's not really, all the questions are coming in. So hello, Simon. Can we somehow extract the WOQL into Perthas so it can be used outside of TerminalistDB? Okay, I'm reading it. So, sorry, what's the, could you repeat? Like, oh, the Waco interpreter, is it? Yeah. Yes, basically, can you do the interpreter without TerminalistDB? So can you just use that? Yes, well, actually Waco is designed for TerminalistDB. So you need something that kind of take the same protocol. So in theory, you could build something as we open source, you can make a clone of it. And then, you know, you can change it, you know, change the store or something if you want to. And it will still talk well with Waco. But the problem is that, you know, like, because I don't know why you would do that because, but, you know, we are open source, you can totally make your own version of TerminalistDB that also work with Waco, that's still fine. But if you want to, for example, plug it to, you know, use it with, with MySQL that I don't know, or plug it to use with Neo4j, no, because Neo4j use cyber. So it won't work that way. It's just, yeah, it's a protocol to talk with, you know, for the front end, you know, the client to talk with the back end, which is the TerminalistDB. So TerminalistDB is built with ProLoc, actually. If you're interested, you can actually totally, you know, look at that rapport and we love contributors, yeah. Okay, there's another question in the chat on the talk channel. For the graphs, does the JavaScript client have a graph for the visualization? Yeah, actually the console, so we, okay, so it's a little bit explaining what we have right now. So right now if you, you know, we have a console that is kind of like a front end thing, I cannot show you here, actually. I hope I have one running locally. So yeah, local host, I hope is still running. I haven't stopped it. So you can actually get this for yourself. And, you know, this is a, you know, a console. And then here, actually, if I go into any one of these and you see that this is, oops. Yeah, my computer is super slow at the moment, I think because I'm doing a lot of streaming. Oh, it doesn't want to work. Okay, so you can actually make a query here. So here, I can make all the queries and all the stuff. So, so what was the question again? Sorry, I'm being lost. The question was for the graphics, does the JavaScript client have graph visualization? Right, so it actually has. So let me see if I can do this. So this is not planned, right? So I don't know whether it would work. Oh, it's not defined, was I spelled wrong or yeah. So can I get the result please? No, it doesn't. I don't know what I've done with it, but actually you can see it in a graph visualization. It's not here, but before, because we have two versions. So in the previous version, we'll have a graph visualization that you can actually put in a script and the script can basically let you control. It's like plotting with Mapo Lib, let's say. You can control how it looks. You can control which to show, which not to show and things like that. But right now, we still have the visualization, but all this customization is off temporarily because we are still, we have to upgrade it from our previous version to this version. And yeah, and it kind of, yeah, takes a time. Okay, I think we'll have to move the rest of that into the chat. So thank you very much for the talk. If somebody presses control K and types a query, you'll find the chat and can continue this. So thanks for the great talk. Here's your applause. Thank you.