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

Manas tasks #239

Closed
17 of 19 tasks
cvvergara opened this issue Jul 21, 2022 · 1 comment
Closed
17 of 19 tasks

Manas tasks #239

cvvergara opened this issue Jul 21, 2022 · 1 comment

Comments

@cvvergara
Copy link
Member

cvvergara commented Jul 21, 2022

  • file with all the working examples of the python documentation of postgresql

    • The file should be executed by loading the file into the database
      -- psql sampledata
      \i example.sql
      
  • file with the python example of or_tools https://developers.google.com/optimization/introduction/python

    • figure out how to import a module
      from ortools.linear_solver import pywraplp
      from ortools.init import pywrapinit
      
    • The function at this moment in time just returns a boolean until further notice
  • figure out how to send a notice/warning/exception message

    • the prints -> message to postgres]
  • creating a type

    • output one row with all the values
    • output 2 rows (with same info)
    • have parameter number of rows
      • output as many rows as parameter value
  • figure out if without creating a type there can be output

    • output one row with all the values
    • output 2 rows (with same info)
    • have parameter number of rows
      • output as many rows as parameter value
  • continue growing the example

  • find more examples

@cvvergara
Copy link
Member Author

So going by baby steps that task above basically means that this works

CREATE FUNCTION overpaid ()
  RETURNS boolean
AS $$
from ortools.linear_solver import pywraplp
return False
$$ LANGUAGE plpython3u;

Where "figure out how to import a module " means that

from ortools.linear_solver import pywraplp

is not how you import that module that is needed on a postgres function, because it fails.

Do baby steps mean that you keep your focus on the task at hand, which is to import the module that is needed, do not add more code that gets on the way for the task at hand.

If you comment out that

# from ortools.linear_solver import pywraplp

the tests will run smoothly I think.
I am going to do that.
hmm, I am maybe doing more changes.
In my computer it is running.
but on the action I am getting:

psql:setup_db.sql:17: ERROR: could not open extension control file "/usr/share/postgresql/14/extension/plpython3u.control": No such file or directory

Fixing the actions, don't know how many tries I will make
I will not fix my licence aaction, but you, please make sure to have the license on your sql files

Tada, now everything is passing,
https://github.com/cvvergara/GSoC-pgRouting/actions/runs/2820090019
So, first run it with that line commented like here.
https://github.com/cvvergara/GSoC-pgRouting/blob/Manas23601-manas-week-6/sql/or_tools/example.sql#L35
And then the task of "figure out how to import a module" is to make that single line work.

Please inspect the history of commits I made.
https://github.com/cvvergara/GSoC-pgRouting/commits/Manas23601-manas-week-6

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

No branches or pull requests

1 participant