IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
220 stars 115 forks source link

Add a `pyam.iiasa.platforms()` function #829

Closed danielhuppmann closed 3 months ago

danielhuppmann commented 4 months ago

Please confirm that this PR has done the following:

Description of PR

This PR adds a method pyam.iiasa.list_platforms() as a shorthand for the ixmp4 function down in the config hierarchy, producing an output like:

IIASA platform      Access    Notice

public-test         public    This is a public ixmp4 test instance hosted by the ... 
ecemf               private   
genie               public    This is a development instance for the GENIE knowle... 
ssp-extensions      public    
ecemf-internal      private   

5 total 

I modified this from the corresponding method in ixmp4 showing name, access level and notice (instead of dsn), because this seems more relevant for a Python-API-user.

@meksor, if you agree, I can implement the corresponding change in ixmp4?

Update

Renamed the function to pyam.iiasa.connections() to avoid naming conflict with the ixmp4 method.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.8%. Comparing base (666d49c) to head (5d65095).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #829 +/- ## ===================================== Coverage 94.8% 94.8% ===================================== Files 64 64 Lines 6125 6144 +19 ===================================== + Hits 5810 5829 +19 Misses 315 315 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

meksor commented 4 months ago

Hm it would be useful to see if one is connecting via rest or sqlalchemy, maybe just showing the protocol part of the dsn? Something like dsn.split('://')[0]

danielhuppmann commented 4 months ago

Hm it would be useful to see if one is connecting via rest or sqlalchemy, maybe just showing the protocol part of the dsn?

My suggestion only refers to the attributes when connecting via the manager - the toml would still have the dsn.

meksor commented 4 months ago

Ah I see, alright convinced!