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

feat: escape column names #160

Merged
merged 1 commit into from
Nov 18, 2022
Merged

feat: escape column names #160

merged 1 commit into from
Nov 18, 2022

Conversation

Sekhmet
Copy link
Contributor

@Sekhmet Sekhmet commented Nov 18, 2022

Summary

Escape column names in queries so reserved keywords can be used as columns.

Depends on #159

Test plan

Apply this diff in sx-api

diff --git a/src/schema.gql b/src/schema.gql
index 978b787..49d5ff5 100644
--- a/src/schema.gql
+++ b/src/schema.gql
@@ -25,7 +25,7 @@ type Proposal {
   id: String!
   proposal_id: Int
   space: Space
-  author: User
+  from: User
   execution_hash: String
   metadata_uri: String
   title: Text
diff --git a/src/writer.ts b/src/writer.ts
index ab167a9..e79e085 100644
--- a/src/writer.ts
+++ b/src/writer.ts
@@ -74,7 +74,7 @@ export async function handlePropose({ block, tx, event, mysql }) {
     id: `${space}/${proposal}`,
     proposal_id: proposal,
     space,
-    author,
+    from: author,
     execution_hash: data.execution_hash,
     metadata_uri: metadataUri,
     title,

Run this query:

{
  proposals(where: {from: "0x556B14CbdA79A36dC33FcD461a04A5BCb5dC2A71"}) {
    id
    from {
      id
    }
  }
}

@Sekhmet Sekhmet requested a review from bonustrack November 18, 2022 11:06
@Sekhmet Sekhmet self-assigned this Nov 18, 2022
Copy link
Contributor

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

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

utACK

Base automatically changed from sekhmet/update-rpc-format to master November 18, 2022 13:11
@Sekhmet Sekhmet force-pushed the sekhmet/escape-column-names branch from ff457bb to bd01e99 Compare November 18, 2022 13:12
@Sekhmet Sekhmet merged commit d37c707 into master Nov 18, 2022
@Sekhmet Sekhmet deleted the sekhmet/escape-column-names branch March 3, 2023 19:28
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.

2 participants