Title: PythonQL3 pattern matching not working · Issue #18 · pythonql/pythonql · GitHub
Open Graph Title: PythonQL3 pattern matching not working · Issue #18 · pythonql/pythonql
X Title: PythonQL3 pattern matching not working · Issue #18 · pythonql/pythonql
Description: Hi there, I've recently discovered PythonQL - Wow! I spent my spare time over the last 2 days to go through the intro and tutorial and have created a python script with all the examples in there. Everything works beautifully except for t...
Open Graph Description: Hi there, I've recently discovered PythonQL - Wow! I spent my spare time over the last 2 days to go through the intro and tutorial and have created a python script with all the examples in there. E...
X Description: Hi there, I've recently discovered PythonQL - Wow! I spent my spare time over the last 2 days to go through the intro and tutorial and have created a python script with all the examples in ther...
Opengraph URL: https://github.com/pythonql/pythonql/issues/18
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PythonQL3 pattern matching not working","articleBody":"Hi there,\r\n\r\nI've recently discovered PythonQL - Wow! I spent my spare time over the last 2 days to go through the intro and tutorial and have created a python script with all the examples in there. Everything works beautifully except for the two pattern matching examples.\r\n\r\nThe sample data is as follows\r\n\r\n```\r\npeople = [ {'first':'John', 'last':'Doe', 'age':30,\r\n 'address' : {'city':'San Jose', 'zipcode':92122}},\r\n {'first':'Daniela', 'last':'Kleene', 'age':40, \r\n 'address' : {'city':'San Jose', 'street':'Main', 'zipcode':92314}},\r\n {'first':'Jerry', 'last':'Lee', 'age':50, 'occupation':'Engineer', \r\n 'address' : {'city':'San Jose', 'zipcode':93213}}\r\n]\r\n```\r\n\r\nThe first pattern matching example is as follows:\r\n\r\n```\r\nres = [ select (l, z)\r\n match {\r\n \"last\" : as l,\r\n \"age\" : as a where a \u003e 25,\r\n \"address\" : {\r\n \"city\" : \"San Jose\",\r\n \"zipcode\" : as z\r\n }\r\n } as x in people ]\r\n```\r\n\r\nNow this first example works 100%.\r\n\r\nThe second pattern matching example is as follows\r\n\r\n```\r\nres = [ select x\r\n match {\r\n \"last\" : as _,\r\n \"first\" : as _,\r\n \"age\" : as a where a \u003e 25,\r\n \"address\" : {\r\n \"city\" : as _,\r\n \"zipcode\" : as _\r\n }\r\n } as x in people ]\r\n]\r\n```\r\n\r\nThis second pattern matching example has an error in that there appears to be an extra closing square bracket at the end. \r\n\r\nRemoving this bracket is obviously fixes the syntax error. This example is however supposed to return only the first record because it matches exactly - meaning it has all the same fields as the query but this example returns every record - according to the tutorial but it returns all the records (maybe this is the correct behaviour?). \r\n\r\nIf I now add an `occupation` field to the pattern it matches only the record that contains the occupation field. If I add a `street` field to the pattern nothing matches. If I now remove the `occupation` field but leave the `street` field in the pattern it matches the record that has the `street` field. \r\n\r\nAm I missing something here? Or is the tutorial incorrect?","author":{"url":"https://github.com/erasmusa","@type":"Person","name":"erasmusa"},"datePublished":"2020-04-12T08:34:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/18/pythonql/issues/18"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bd989298-0daa-9376-ab04-3aa90385ff2e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E812:3C2B7:B2B7A:F7B28:6981D0C2 |
| html-safe-nonce | f046bad26b9d41f0582d5861c9d39ecfd8909228963efd747b3627cecca0885d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODEyOjNDMkI3OkIyQjdBOkY3QjI4OjY5ODFEMEMyIiwidmlzaXRvcl9pZCI6Ijg1NDQ4ODEwNzQwMjk4NDI2MjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fd41cc24b7019a4a5ffa722a1fe304acee351878356f8d7599df02e779b59872 |
| hovercard-subject-tag | issue:598437509 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonql/pythonql/18/issue_layout |
| twitter:image | https://opengraph.githubassets.com/512a999b7cf9e550cd200fd9837bc76390b658eab0dedbe68bc89ddf4358b88a/pythonql/pythonql/issues/18 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/512a999b7cf9e550cd200fd9837bc76390b658eab0dedbe68bc89ddf4358b88a/pythonql/pythonql/issues/18 |
| og:image:alt | Hi there, I've recently discovered PythonQL - Wow! I spent my spare time over the last 2 days to go through the intro and tutorial and have created a python script with all the examples in there. E... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | erasmusa |
| hostname | github.com |
| expected-hostname | github.com |
| None | ebfdf8d3e0fd17b103f41cc6696d84938694ebebdfecaf11fe00dbe4a9785801 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonql/pythonql git https://github.com/pythonql/pythonql.git |
| octolytics-dimension-user_id | 22842849 |
| octolytics-dimension-user_login | pythonql |
| octolytics-dimension-repository_id | 58056458 |
| octolytics-dimension-repository_nwo | pythonql/pythonql |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 58056458 |
| octolytics-dimension-repository_network_root_nwo | pythonql/pythonql |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac96edcf00b294dfaa8f1b86d06a198589e60041 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width