One project every month - making stuff better ...

GITHUB_UTL Tutorial 5: Selecting information from GitHub.

How do you use the GITHUB_UTL package to select information from your account? You can use the github_tables package, which is basically a collection of pipelined functions that uses the rest of the api to get information out in a row based fashion. So fire up your sqlplus and login as the user that installed the github packages.

As always my parameters for this session is:
Wallet location/home/oracle/wallet
Wallet passwordWalletPasswd123 usernamegithub-user passwordgitPass123

To authenticate the session against GitHub we need to run 2 commands. One to setup wallet access, and one to set the session authentication variables. To set the wallet location run the following:

exec github.set_session_wallet('file:/home/oracle/wallet', 'WalletPasswd123');
And then to authenticate against GitHub:
exec github.set_logon_info('github-user', 'gitPass123');

If we for instance want to know what repositories we have, and the basic information of them, we can run the following select:

SQL> select repos_id, repos_name, repos_owner, repos_description from table(github_tables.repositories);

---------- -------------------- ------------ ------------------------------------------------------------
16406306 codemonth morten-egan null
15437721 docdb morten-egan Documentation of your oracle plsql code - automatically.
16639834 github_utl_test morten-egan null
16204602 lf morten-egan null
16097870 oraclegit morten-egan Integration of Oracle and Github
10263512 sqlpl-us morten-egan A web based sqlplus like interface for Oracle databases
11471555 toolbox morten-egan

7 rows selected.

Or if we wanted to know what languages were part of the toolbox project:

SQL> select * from table(github_tables.repository_languages('toolbox'));

-------------------- -------------------- ----------
toolbox Shell 5240
toolbox Python 403


So as you can see we can start to use this utility for more than just saving stuff in our repository. Tune in for even more information about how to use this package to help you control and manage your source code in your databases. Next tutorial will show how to compare the code in your database with code in your repository.

Tagged in : Advanced Queuing, DBMS_NETWORK_ACL_ADMIN, DBMS_SCHEDULER, Database Triggers, UTL_ENCODE, UTL_HTTP, UTL_RAW, sys_context