I'm trying to get sqldelight setup in my project. ...
# server
b
I'm trying to get sqldelight setup in my project. The docs seem to be missing several steps. The few examples/guides I've found simply are not working out. Cloning example code is just a time waster. If anyone has a moment to help me out to just get started, I'll throw you a $20. TeamViewer and walk me through for ~10 minutes. Answer a few basic questions, help me get the configuration sorted on my local machine.
p
Check if this project works for you: https://github.com/pablichjenkov/kmp-amadeus-api No time for a call but you can open an issue/discussion on GitHub if something doesn't work after just cloning it
🙏 1
h
Any feedback to improve the docs is welcomed.
👍 2
b
I'll comment back once I get things sorted. Am coming at this from the perspective of a total newbie with this ecosystem, so will probably be suggesting things which seem obvious to mature devs.
I couldn't figure it out. This isn't for the server and has an
iosApp
module. Couldn't make sense of the code. Thanks for trying to help. I might just ditch KMM and work with something that's a bit more sane
I'm not sure if this is something specific to Kotlin or KMM or where this insanity is sourcing, but I can't figure out how to sanely debug in this environment. It's like most things are done in the background and not available for debugging. if that's the case, this truly isn't worth it. Developers need to be able to zoom in on issues. I have no idea how to make sense of the minimal output
h
Without more details it’s hard to help you. What exactly do you want to achieve?
b
@Brandon Chapman Sharing a screenshot or log will help us.
b
I don't think it would help. There's a single line of output.
image.png
This is intelliJ, I've started the program from the main function in debug mode. Placed stops at the entry point. This is the result
1 - 4 done
I'm seriously trying to find any running example that uses this library on the server and can connect to postgresql database and generate the table
Have tried for about 8hrs with countless variations across multiple example projects and trying from scratch
I'll give someone $50 if they are proficient with KMM + sqldelight and can give me an hour of their time higher bandwidth to get this setup properly
😁 1
image.png
h
What problem do you have exactly?
b
Well, it won't build. I can't figure out if it's doing anything without it compiling
image.png
h
And what’s the error message?
b
ERROR: 'void com.alecstrong.sql.psi.core.SqlFileBase.<init>(com.intellij.psi.FileViewProvider, com.intellij.lang.Language, java.util.Collection, int, kotlin.jvm.internal.DefaultConstructorMarker)'
No clue how to make sense of that. Wish I could use the debugger 🤷‍♂️
h
The debugger does not help you, it’s a bug in sqldelight. Use the latest version 2.0.2
1
In the plugin, runtime and dialect.
b
success! new error unlocked
this is something I can work with 🙂 thank you
👍 1
I'm now stuck at this error: It looks like the queries are generated but not the actual table
works fine from CLI manually: Running after manual creation gets me further. The script simply doesn't run automatically. No entries into the table 🤷‍♂️
manually created the table and inserted records. Same error. This is bizarre behavior
Well, I can get it to work if I generate the schema manually. That sucks. I was hoping this would work on it's own. Ah well, guess I have to move on and consider this a partial success
p
There is an SQLDelight plugin for IntelliJ and Android Studio. It help with some of the stuff. In a pipeline you probably want to have your custom gradle task that ensures to call the schema and other classes generation before the build starts.
b
Thank you. I've got the plugin installed. Do you mean I should create a custom gradle task that will generate the schema? Guess I'm confused. My understanding is that this plugin should be able to generate initial schema and handle migrations.
p
Sorry I might have confused you. The
app.cash.sqldelight
gradle plugin comes with a couple of gradle task that hook at the right time of the build and generate the classes. I just this habit of calling it all the time but it might be unnecessary. However, the migration afaik is performed in code when the App starts. The gradle tasks generates the schemas and associated classes but you still need to do some stuff from code.
b
No need to apologize. I'm just this ignorant and there's a communication gap. Appreciate you taking the time to try and bridge the divide. Okay. So perhaps I can call these manually. Will work on that now. It's not working out automatically as it should for some reason
👍 1
I dropped the table in psql, ran the 4 gradle taks associated with sqldelight, then tried to run the program again. Same result. It's still failing to create the table. I wonder why it generates the interfaces but won't actually create the table
image.png
p
Humm I see, you perhaps should research for specific postgress and sqdelight integration. I really can’t help there since I have only use it with sqlite in mobile related environment blob shrug
There is actually a channel for square related libraries including sqldelight, here #squarelibraries
1
b
Just joined. You get another donation via Github Sponsors. Enjoy your evening 🤝
p
Jaja that's funny tho, I am good don't worry about that.
b
I solved the issue of relations not being created. This example project appears to have set incorrect configuration for Hikari. Shifting
isAutoCommit
to
true
resolved issues. Man I was burnt out the other day 😅
🎉 1
😸 1