Lompat ke konten

Pelajaran 23 ยท Operations, Quality and Governance

Security, Governance and Cost

Protect and run a warehouse: least privilege, row and column controls, masking, retention, auditing, governance roles, change management and cost control.

A warehouse gathers data from across an organization, which makes it valuable and risky. It often holds personal, financial and commercially sensitive information in one place. Security, governance and cost control are part of the job from the first table.

This lesson is general education, not legal advice. Your obligations depend on your location, industry and contracts, so involve your privacy, legal and security specialists.

Classify first

You cannot protect what you have not identified. Label datasets and columns with a sensitivity level that your organization defines, for example public, internal, confidential and restricted. Mark personal data and any special categories that need extra care.

Then ask a simpler question: do you need this data at all? Data you never load cannot leak from your warehouse. This is data minimization.

Access control

Apply least privilege: each person and program gets only what it needs.

  • Grant permissions to roles (or groups), and add people to roles.
  • Use separate service accounts for loading, transforming and reporting.
  • Require strong sign-in, such as single sign-on with multi-factor authentication where available.
  • Keep keys and passwords in a secret manager.
  • Review access regularly and remove it promptly when people change jobs or leave.
SQL
-- Read-only: role-based grants (syntax differs; SQLite has no users or GRANT)
CREATE ROLE sales_analyst;
GRANT USAGE ON SCHEMA mart_sales TO sales_analyst;
GRANT SELECT ON mart_sales.fact_sales TO sales_analyst;
GRANT sales_analyst TO maria;

Fine-grained controls

Control What it limits
Column-level security Which columns a role can read
Row-level security Which rows a role can see, such as their own region
Dynamic masking How a value is shown, depending on the role
Tokenization or pseudonymization Replaces identifiers with substitutes
Encryption Protects data in transit and at rest

Native features vary by platform. A view can demonstrate the idea:

SQL Stand-in: masked and filtered views

Press Run (or Ctrl + Enter) to see the result here.

The view hides names, masks emails and shows only northern customers. Two warnings apply. First, masking still reveals something, such as the email domain. Second, removing names does not make data anonymous: combinations such as postcode, birth date and purchases can identify people. Pseudonymized data can often still be linked to a person and should be protected accordingly.

Aggregates can leak too. A "total salary" for a group with one member reveals that person's salary. Some reports set a minimum group size, though that alone does not stop someone from comparing overlapping totals.

SQL Hide groups that are too small

Press Run (or Ctrl + Enter) to see the result here.

Retention, deletion and copies

Define how long each kind of data is kept, and automate removal. A request to delete a person's data may reach staging, dimensions with history, backups, extracts and files that were exported. Lineage helps you find them. Do not copy production personal data into development without protection; use masked or synthetic data.

Auditing and recovery

  • Record who accessed and changed what, and protect these logs.
  • Alert on unusual activity, such as very large exports.
  • Test restores, not only backups. Decide how much data you can afford to lose (recovery point objective) and how long recovery may take (recovery time objective).

Governance roles

Data governance is how an organization decides who is accountable for data and by which rules.

Who is accountable?

Data owner Accountable for access and use
Data steward Cares for meaning and quality
1 / 2

Titles vary. What matters is that every important dataset has a named person who can make decisions about it.

Change management

Treat the warehouse like software:

  1. Keep schemas, transformations and permissions in version control.
  2. Review changes and run tests in a non-production environment.
  3. Check downstream impact before renaming or removing columns.
  4. Prefer additive changes; announce breaking changes and give a transition period.
  5. Keep a way to roll back or rebuild.

Cost control

Cloud costs often follow usage, and how they are measured depends on your platform. Practical habits:

  • Attribute spending to teams or workloads with tags, labels or separate compute.
  • Set budgets, alerts and query limits where available.
  • Stop idle compute if your platform charges for it.
  • Fix the expensive queries and refreshes first.
  • Expire temporary tables and unused copies.
  • Refresh data only as often as people need it.

Check your vendor's official pricing pages for current terms.

Review a new dataset before loading it

A short review at the start is much cheaper than a cleanup later. Ask:

  1. What is the purpose of loading this data, and who approved it?
  2. Does it contain personal, secret or contractually restricted information?
  3. Which columns are really needed? Can others be dropped or generalized, such as birth year instead of birth date?
  4. Who may read it, in which layer?
  5. How long is it kept, including raw copies?
  6. In which region may it be stored and processed?
  7. How would you delete one person's or one customer's data?

Record the answers next to the table description. Revisit them when the purpose changes, because permission to use data for one purpose does not automatically cover another.

Exports are copies too

Controls inside the warehouse stop at its edge. A downloaded spreadsheet, a BI extract or a file sent to a partner does not carry your row filters or masking rules with it. Limit who can export sensitive data, prefer shared dashboards over attached files, give extracts an expiry date and log large downloads where your tools allow it. The same care applies before pasting query results into any external service, including an AI assistant: check your organization's rules first.

Pipeline security

Loading jobs often have broad rights, which makes them attractive targets. Give each job only the schemas and operations it needs. A job that reads a source should not be able to write to it. Rotate credentials, keep them out of code and logs, and review changes to transformation code, because whoever can change that code may be able to change or copy data. Build SQL with parameters or strict allow lists when any part comes from user input, to prevent SQL injection.

Common mistakes

Shared accounts and broad "everyone can read everything" grants are easy at the start and hard to undo. They also make audit logs useless, because you cannot tell who did what.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does least privilege mean?

    Limiting access reduces the damage from mistakes and stolen credentials.
  2. 2. Why is a masking view alone not enough?

    Permissions must block direct access to the underlying data.
  3. 3. Which statement about removing names from data is correct?

    Quasi-identifiers can single people out, so protection is still needed.
  4. 4. What proves that backups are useful?

    Only a restore shows the data can really be recovered.

Summary

  • Classify data, collect only what you need and apply least privilege.
  • Use row, column, masking and encryption controls, and understand their limits.
  • Plan retention, deletion, auditing and tested recovery.
  • Name owners, manage changes carefully and watch cost by workload.

Next: Project: Build a Retail Sales Warehouse

Progres Anda disimpan di browser ini. Tidak perlu akun.