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

SQL Generation #31

Merged
merged 49 commits into from
Sep 29, 2016
Merged

SQL Generation #31

merged 49 commits into from
Sep 29, 2016

Conversation

jrans
Copy link
Member

@jrans jrans commented Sep 23, 2016

THIS PR

Main issue: #11

In this PR we create handlers for db interactions:

  • create table
  • insert
    • takes object of the form { fields }
  • update
    • takes object of the form { fields, where }
  • delete
    • takes object of the form { where }
  • select
    • takes object of the form { select, where }

Check update to README.md to see necessary steps to run db tests. #34

eliasmalik and others added 24 commits September 23, 2016 16:34
+ mapper that takes name, type and extra config options and produces sql string to create a column for setting up table
+ works for both pqsl and sql
…able with the correct fields and types; issue #11
+ use joi to validate the config for creating a table
Related: #39
@nelsonic
Copy link
Member

@Looks promising. assign when ready. 👍

@eliasmalik
Copy link
Contributor

@nelsonic the build is failing b/c there's no travis YAML (it's on @SimonLab 's PR) so travis is trying to run the node app in ruby. If you run the tests manually, they all pass. There are linter errors, but we want to sort those out in a separate PR (see #46). So I think this PR is OK to review! 👍

@eliasmalik
Copy link
Contributor

eliasmalik commented Sep 28, 2016

Have now:

  • merged with master
  • sorted conflicts
  • fixed linter errors (@Shouston3)
  • added postgres to travis config to fix failing tests

@nelsonic please have a look!

@nelsonic
Copy link
Member

WoW! 830 Lines ... better get to it! 👀

.unknown()
;
var configSchema = Joi.object().keys({
table_name: Joi.string().regex(dbNameRegEx).required(), // eslint-disable-line
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

purely out of curiosity, why do these lines need to be disabled for eslint?

Copy link
Contributor

@eliasmalik eliasmalik Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nelsonic because there's a rule that says max of 2 chained method calls per line. Bit annoying in this case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, lame. although for git diff purposes splitting over more lines is more review-able... (fine for now)

configValidator(config);

return client.query(sqlGen.init(config), cb);
} };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this pass the linter?
(thought it would require the init to be on a new line and these closing brackets too... if not. fair enough...)

@jrans jrans mentioned this pull request Sep 29, 2016
@@ -0,0 +1,18 @@
'use strict';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does goodparts enforce having the 'use strict'; at the top of our files...?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we have added this rule in the goodparts config:
dwyl/goodparts#128
I'm not sure if we should use it, maybe we can reopen this issue on goodparts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @SimonLab. yes, I agree we need to understand the benefits of the 'use strict'; directive.

@@ -0,0 +1,18 @@
'use strict';

exports.values = function (obj, keys) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these utils independently unit-tested somewhere?

Copy link
Member Author

@jrans jrans Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are unit tests here for everyone except except ! @eliasCodes i'll write it?

@nelsonic
Copy link
Member

Code looks good. merging. 👍

@nelsonic nelsonic merged commit 375a801 into master Sep 29, 2016
@nelsonic nelsonic deleted the sql-generation branch September 29, 2016 09:43
@samhstn samhstn mentioned this pull request Sep 30, 2016
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.

5 participants