spanner-terraform-example's People
spanner-terraform-example's Issues
General remarks
@vignesh-sdev @rohan-searce @yogirk
I had a couple of general remarks on the current application setup, but as those files are currently not touched by any of the open PRs, it's a little bit difficult to add comments on it. I've therefore summarized it here in an issue.
Please feel free to let me know if something is not clear, or if I've misunderstood anything.
Data Model
The data model of the application uses FLOAT64
for several properties that would be better represented by other data types:
- Number of shares, both of a company as well as trade volumes, are always integers. It would be better to use
INT64
instead ofFLOAT64
. - Share prices are normally specified as fixed-precision numbers. It would therefore be better to use
NUMERIC
instead ofFLOAT64
for these properties.
See
Executing queries
There are multiple queries in the application that do manual conversion of the query results to JSON. That can be done automatically by the Spanner client library by setting the json: true
option in the query.
For example the function here could therefore be simplified to this:
Users.prototype.getAllUsers = async function () {
try {
const query = {
sql: 'select * from company',
json: true,
};
return await database.run(query);
} catch (err) {
throw ("error in getAllUsers function", err)
}
}
You should also consider adding some kind of protection against out-of-memory problems in a query like this. Selecting all rows from a table without a WHERE
or LIMIT
clause could bring down your entire application if the table grows beyond the size that you expected.
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.