Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sqlite resource #6

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Ughuuu
Copy link

@Ughuuu Ughuuu commented Jan 24, 2025

Makes sqlite resource visible in editor

src/resource_sqlite.h Outdated Show resolved Hide resolved
@fire
Copy link
Member

fire commented Jan 24, 2025

Tutorial on godot engine resources

The normal flow is you only have one remap pointer like res://model.whisper and one data resource in res://.godot/imported/model-ADSADSAGFASBASDSADASDA.res.

Using godot-whisper design. This is also a problem in iree.gd and this sqlite pull request.

Problem 1

In your design, you have no pointers, and the data resource is the string of the path. So you must go to the export dialogue and manually whitelist the whisper model.

Problem 2

I can only ZSTD compress the resource data, a string like "res://model.whisper".

I want Godot Engine to compress the model with ZSTD compression as a .res resource like a packed byte array.

Problem 3

I want to transfer the model over the network. Syncing the data property with a resource is enough to do this.

src/godot_sqlite.cpp Outdated Show resolved Hide resolved
@fire
Copy link
Member

fire commented Jan 24, 2025

It MAY be called data or some other property name.

It MUST have a property that stores a transformed database data structure.

https://datatracker.ietf.org/doc/html/rfc2119#section-1

Example workflow 1:

  1. copy the database to make it readable and writable to user://
  2. load database at user://some_database.sqlite

Example workflow 2:

  1. The inspector window can be edited during the development stage
  2. On publish, the database is locked unless workflow 1

src/godot_sqlite.cpp Outdated Show resolved Hide resolved
src/resource_sqlite.h Outdated Show resolved Hide resolved
src/godot_sqlite.cpp Outdated Show resolved Hide resolved
src/resource_sqlite.cpp Outdated Show resolved Hide resolved
@fire
Copy link
Member

fire commented Jan 26, 2025

I don't have enough design sense to review adding an ORM.

void create_table(const String &p_table_name, const TypedArray<SQLiteColumnSchema> &p_columns);
void drop_table(const String &p_table_name);

void insert_row(const String &p_name, const Dictionary &p_row_dict);
void insert_rows(const String &p_name, const TypedArray<Dictionary> &p_row_array);

Array select_rows(const String &p_name, const String &p_conditions, const Array &p_columns_array);
bool update_rows(const String &p_name, const String &p_conditions, const Dictionary &p_updated_row_dict);
bool delete_rows(const String &p_name, const String &p_conditions);
TypedArray<String> get_table_names() const;
TypedArray<SQLiteColumnSchema> get_columns(const String &p_name) const;
Variant execute(const String &p_query_string);

For this pull request, please keep creating a resource database and the create_query code path for that resource because I can't figure out the shape of the mapper.

I would postpone the object relation mapping to a subsequent pull request.

https://martinfowler.com/bliki/OrmHate.html suggests either spending a lot of time writing a better objection relation mapper or avoiding the problem.

Edited:

According to the title, a SQLite resource is what is requested, not an Object Relation Mapper.

src/node_sqlite.h Outdated Show resolved Hide resolved
@Ughuuu Ughuuu force-pushed the add-sqlite-resource branch from 22af952 to 354fa66 Compare January 27, 2025 19:25
@fire
Copy link
Member

fire commented Jan 27, 2025

What parts did Piet Bronders & Jeroen De Geeter do?

@fire
Copy link
Member

fire commented Jan 27, 2025

Can you separate the object relation mapping system into a different pr?

I have to focus on other essential tasks, and I want to merge the Resource saver, resource loader, and sqlite node.

Also, I'm curious about who those third-party people are.

@Ughuuu
Copy link
Author

Ughuuu commented Jan 27, 2025

What parts did Piet Bronders & Jeroen De Geeter do?

Well, no parts he did, but the High Level api is similar to his one (and I took inspiration from his repo)
https://github.com/2shady4u/godot-sqlite

@Ughuuu
Copy link
Author

Ughuuu commented Jan 27, 2025

Can you separate the object relation mapping system into a different pr?

I have to focus on other essential tasks, and I want to merge the Resource saver, resource loader, and sqlite node.

Also, I'm curious about who those third-party people are.

I could try later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make sqlite database a resource
2 participants