Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test SQLFluff with some SQL files #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Saphall
Copy link
Owner

@Saphall Saphall commented Apr 23, 2024

Description:

Test sqlfluff CI using the bad sql codes.


Before:

  • src/migrations/employee_migration.down.sql
drop table if exists raw.employee;
  • src/migrations/employee_migration.up.sql
create table raw.employee (
  id BIGINT IDENTITY (1, 1) primary key,  first_name VARCHAR(300),   last_name VARCHAR(300), address varchar(300)
);

The CI failed with error:
image


After:

sqlfluff fix src/migrations

image

  • src/migrations/employee_migration.down.sql
DROP TABLE IF EXISTS raw.employee;
  • src/migrations/employee_migration.up.sql
CREATE TABLE raw.employee (
  id BIGINT IDENTITY (1, 1) PRIMARY KEY,
  first_name VARCHAR(300),
  last_name VARCHAR(300),
  address VARCHAR(300)
);

The CI passed after the fix:
image

@Saphall Saphall self-assigned this Apr 23, 2024
@Saphall Saphall changed the title Add migration files Test SQLFluff with some SQL files Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant