Comments (2)
@PGimenez
You could use this kind of convention where you use the same id for both but it's a bad idea, for multiple reasons:
a) it does not work in real life, with concurrent access (multiple users). When you have multiple users adding rows, the insert operations will run out of sync, becoming very difficult to "reserve" ids.
b) in terms of database design, it's not a good approach - by using foreign keys you can define relationships at database level to trigger cascade deletes and other operations.
c) same goes for what the users expect - most people will understand that there is a relationship by looking at the foreign keys.
d) SearchLight maps to the concept of primary key <-> foreign key with the Relationships API, allowing to set and manage relationships.
As such, we'd be showcasing a non-standard and not good approach to DB design, which is not ideal for a tutorial. Best thing would be to use the SearchLight Relationship API (which is not extensively documented though).
from genieframeworkdemos.
But if you run a quick initial iteration using this approach, it won't work through the ORM. You'll need to run a query, something like:
prediction.price = model([getfield(house, i) for i in 2:14])[1]
prediction.error = abs(prediction.price - house.MEDV)
prediction.timestamp = string(now())
@show prediction
save!(prediction)
SearchLight.query("
UPDATE predictions set id = $(house.id) where id = $(prediction.id)
")
# then retrieve prediction using the new id, if neede
prediction = findone(Prediction, id = house.id)
from genieframeworkdemos.
Related Issues (8)
- StipplePlotlyExamples: Why project.toml contains url of packages of `aryan` user? HOT 1
- Database demo stuck in a loop at 100% CPU usage HOT 1
- Tutorial IrisClusteringNewAPI not working with the latest GenieFramework HOT 3
- Click events on map demo
- Re-attach to running process, or kill process on page close HOT 7
- unconnected clients lead to high CPU load
- CSVAnalysis is broken HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from genieframeworkdemos.