Closed dondi closed 9 months ago
A network data source setting may be good to add as well—check with @Onariaginosa
I finished the dal function and the dal-calling method, however I have a problem with env variable. The libraries are successfully installed but when I call the execute method I get an error. I tried troubleshooting it but it didn't work, I will try to troubleshoot a little bit more then the web app code would be the only thing left.
@ahmad00m was able to fix the error by using the SQLAlchemy text
import. However this is inconsistent with prior code that we have seen/written. First check is to see if SQLAlchemy versions have changed in this way; also check documentation for session.execute
to see if this is explicitly asked for
Bottom line is we want to determine why text
had to be used in @ahmad00m’s case
And either way, we’ll want to do this in JavaScript anyway, but would be nice to still get an explanation for this
I believe grnsettings-dal function and expression function are ready to replaced the hardcoded dataset name. However, I didn't get a chance to test for that. I will finish the last touches and then make a pull request.
Also, the reason we had to use text for the raw SQL query is explained here. It mentions that the functions of connectionless executions are deprecated for sqlalchemy V.2.0.
@ahmad00m will finish testing the code to retrieve the default expression-dataset name from the database.
I finished debugging the code and tried to replace the hard-coded dataset names in the update-app.js
but I was not successful because I got an issue with node again. I pulled from Ona's branch this morning to see if that fixed the problem but it didn't. I changed the pg version to 8.0.3 and I'm on node 14.21.2 and installed node again, but that doesn't seem to resolve the issue.
I tried incorporating grnsettings database into the update-app.js
but the app crashes when I load the controller file in app.js
. I'm working on figuring out how to solve this, I believe I may be missing an import or there is a bug in my controller/dal files.
This is the error I get when I try to compile my local copy.
We were able to resolve the MODULE_NOT_FOUND
error by making sure that the filename matched the require
parameter
@ahmad00m has implemented all the functions required to retrieve the default dataset name from the database. However, the code is not yet fully functional due to the synchronization issue on the update-app.js
. So, I will have to look into the synchronization method on javascript so that by the time that update-app.js
code is ran the dataset name is retrieved from the database.
@dondi has suggested two ways to resolve this problem.
One is to change all the functions in to async using the await method.
The other solution is to adapt my function to retrieve and save the dataset name into a variable in the .then(response)
method and then use that variable to set the dataset name.
I will first try to adapt my code using the second suggestion and if was unable to resolve the problem we will have to change the settings in the update-app.js
to accept async functions.
A few more details as determined during the power outage meeting of 2023:
grnState
can no longer be a static object; instead, we will need an async
function that produces it. Doing so will allow us to await
the results of database queries in order to populate grnState
await
/then
the final value of grnState
and then use that value for the other functionsgrnState
is static—as @ahmad00m encounters them, we will try to find a minimal-impact strategy to transition thisIf we wish to use the relatively newer async
/await
syntax, we will need to update our linter/compiler to a version that recognizes it
(possible) Links:
I was able to update the eslint from 3.19.0 to 8.38.0 to allow for async await functions. It was interesting to note that during my research I found it eslint supports async await functions at 3.11.0 and above; however for some reason it wasn't functional. Then, I exported grnState
as a async function and also created an async method to retrieve the default database name which seems to be functional. However when I replace the hard code default name with this function the function name still doesn't get retrieved. Moreover, when I converted grnState
into an async function I got the following error which I hope to resolve during the meeting.
Also, I want to note that the second website suggested above was very useful in understanding the async await function and promises.
This issue is resolved with help from @dondi. I committed my code to my branch. I will have to make sure there are no conflicts the current code and perform more testing and will then create a pull request to merge changes to beta.
To manage the impending migration from @Onariaginosa’s work, both @ahmad00m and @ntran18 will seek to manually revise their local databases so that they can fully test their branches
As far as we can tell, the main change is a change of schema name, which can be done manually via the ALTER SCHEMA
command: https://www.postgresql.org/docs/current/sql-alterschema.html
There may be other changes but we can consult #1025 to track those down
@ahmad00m will do these on his local database first since he has more experience but he will then also help @ntran18 afterward
Last lingering issue appears to be linting because the software versions we’re using are not yet aware of async
—this appears to be some combination of version update + possibly configuration, and possibly of eslint or babel or both
Some possible reference links:
I'm not sure what the state of this issue is--assigning to @dondi
This is finally on beta; it can be tested, and local setups will need to be updated to include the new grnsettings
table.
Follow-ups to this issue are on #1062
There is a need to provide a default expression data set to use when creating a brand new network from the database. The right long-term design for this is a grnsettings table which will start with just this column but can expand further: