Git Product home page Git Product logo

Comments (8)

fnc12 avatar fnc12 commented on June 2, 2024

how would you store this in raw SQLite?

from sqlite_orm.

juandent avatar juandent commented on June 2, 2024

a table of strings with a foreign key number representing the external vector element

like this:

STRINGS_TABLE
string id

"Hello" 1
"Goodbye" 1
"Martin" 1
"Julie" 2
"Christian" 2

VECTOR TABLE
id vector_id

1 A
2 A
3 B

VECTOR OF VECTORS
vector id

A
B

is this correct?

from sqlite_orm.

fnc12 avatar fnc12 commented on June 2, 2024

I don't think so. How would you solve this issue if you don't have sqlite_orm but only sqlite3 C library?

from sqlite_orm.

juandent avatar juandent commented on June 2, 2024

what is wrong with this proposal?

from sqlite_orm.

fnc12 avatar fnc12 commented on June 2, 2024

Nothing wrong. But to answer this in terms of sqlite_orm one has to answer this in terms of SQLite first. sqlite_orm doesn't think instead of developer it just makes using SQLite easier. If the developer doesn't know how (s)he wants to store complex structure (vector of vectors in your case) in SQLite column no ORM can help

from sqlite_orm.

juandent avatar juandent commented on June 2, 2024

can you suggest what tables/relationships could work?

from sqlite_orm.

juandent avatar juandent commented on June 2, 2024

I am stuck here

from sqlite_orm.

fnc12 avatar fnc12 commented on June 2, 2024

there are plenty of options and it depends on different conditions including developer's personal preferences. E.g. https://stackoverflow.com/questions/3005231/how-to-store-array-in-one-column-in-sqlite3 . Globally we have two ways:

  1. move arrays and subarrays into dedicated table(s) like it is done in subentities example in our repo
  2. encode/decode the whole array structure into single dynamic value (like blob or string) e.g. json, xml, invent your own an after that adopt this (en/de)coding into custom types binding just like it is done in enum binding examples in our repo

from sqlite_orm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.