mccgr / abn_lookup

Code for creating tables containing the ABN's for companies registered with the Australian Business Register on the ABN lookup website (https://abr.business.gov.au/)
5 stars 3 forks source link

Create admin.sql #1

Closed iangow closed 5 years ago

iangow commented 5 years ago

There should be examples in other repositories. Idea is to set up the database schema.

bdcallen commented 5 years ago

@iangow I followed the template in the analogous file in asxlisting, and have just committed it.

iangow commented 5 years ago

Try running it ... this might work:

psql -d crsp < admin.sql
bdcallen commented 5 years ago

@iangow Yep, I was denied access to create the schema

bdcallen@igow-z640:~/abn_lookup$ psql -d crsp < admin.sql
CREATE SCHEMA
ERROR:  permission denied to create role
ERROR:  role "abn_lookup" does not exist
ERROR:  permission denied to create role
ERROR:  role "abn_lookup_access" does not exist
iangow commented 5 years ago

This might help:

igowmbp15:~ igow$ psql -h 10.101.13.99 -d crsp
psql (11.3)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

crsp=# GRANT CREATE ON DATABASE crsp TO bdcallen;
GRANT
crsp=# ALTER ROLE bdcallen CREATEROLE;
ALTER ROLE

I found this idea here.

iangow commented 5 years ago

I made one more tweak (CREATEROLE) in comment above.

iangow commented 5 years ago

You may need to GRANT abn_lookup TO bdcallen. (Not sure about this one.)

bdcallen commented 5 years ago

@iangow Just tried again and got

bdcallen@igow-z640:~/abn_lookup$ psql -d crsp < admin.sql
NOTICE:  schema "abn_lookup" already exists, skipping
CREATE SCHEMA
CREATE ROLE
ERROR:  must be member of role "abn_lookup"
CREATE ROLE
GRANT

I'll try your suggestion

iangow commented 5 years ago

@bdcallen Is this done?

bdcallen commented 5 years ago

@iangow This is done now, since the code has since worked. Closing now