-
Notifications
You must be signed in to change notification settings - Fork 101
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
Unexpected format with Redshift #25
Comments
Please test your SQL code on http://sqlformat.darold.net/ and let me know if this is the format you are expecting. |
I've also added INTERLEAVED and SORTKEY to the redshift keywords. |
So yes, the encode properly appears on the same line now. Thank you... My only other item is pure preference, is somewhat opinionated in scope. I have found that I sort of like how gofmt handles variable declarations in how it aligns things. var (
version_str = "20170317.1 (cavanaug)"
version = flag.Bool("v", false, "show version number")
debug = flag.Int("debug", 0, "debug log level 0=Error, 1=Warning, 2=Info, 3=Debug, 5=VerboseDebug")
jsonLogging = flag.Bool("j", false, "write the logs in json for easier processing")
listen_port = flag.String("l", ":8888", "port to accept requests")
tls_key = flag.String("key.pem", "", "path to the TLS private key file")
tls_cert = flag.String("cert.pem", "", "path to the TLS certificate file")
target_url = flag.String("a", "http://localhost:8080", "where target (A-Side) traffic goes")
target_timeout = flag.Int("a.timeout", 3, "timeout in seconds for target (A-Side) traffic")
target_rewrite = flag.Bool("a.rewrite", false, "rewrite the host header when proxying target (A-Side) traffic")
clone_url = flag.String("b", "http://localhost:8081", "where clone (B-Side) traffic goes")
clone_timeout = flag.Int("b.timeout", 3, "timeout in seconds for clone (B-Side) traffic")
clone_rewrite = flag.Bool("b.rewrite", false, "rewrite the host header when proxying clone (B-Side) traffic")
clone_percent = flag.Float64("b.percent", 100.0, "float64 percentage of traffic to send to clone (B Side)")
) It is probably too much to ask to expect something similar for sql by implicitly aligning the column names and then type definitions and any trailing constructs in columns like the following. DROP TABLE IF EXISTS sys_info_base CASCADE;
CREATE TABLE IF NOT EXISTS sys_info_base (
"app" VARCHAR(32) ENCODE LZO,
"geo.area_code" VARCHAR(6) ENCODE LZO,
"geo.city" VARCHAR(128) ENCODE LZO,
"geo.continent_code" VARCHAR(2) ENCODE LZO,
"geo.country_code" VARCHAR(2) ENCODE LZO,
"geo.latitude" DOUBLE PRECISION ENCODE RAW,
"geo.longitude" DOUBLE PRECISION ENCODE RAW,
"geo.postal_code" VARCHAR(12) ENCODE LZO,
"geo.region_name" VARCHAR(128) ENCODE LZO,
"geo.region" VARCHAR(8) ENCODE LZO,
"service.oid" VARCHAR(24) ENCODE LZO,
"service.server_timestamp" BIGINT ENCODE LZO,
"data.app_deployed_id" VARCHAR(128) ENCODE LZO,
"data.app_deployed_uuid" VARCHAR(36) ENCODE LZO,
"data.app_id" VARCHAR(128) ENCODE LZO,
"data.app_session_uuid" VARCHAR(36) ENCODE LZO,
"data.schema" VARCHAR(128) ENCODE LZO,
"data.sys_uuid" VARCHAR(36) ENCODE LZO DISTKEY, -- Expect trunctation (from Gotham)
"data.os_architecture" VARCHAR(7) ENCODE LZO,
"data.os_country" VARCHAR(16) ENCODE LZO,
"data.os_language" VARCHAR(16) ENCODE LZO,
"data.os_name" VARCHAR(64) ENCODE LZO, -- Expect truncation
"data.os_screenresolution" VARCHAR(16) ENCODE LZO, -- Expect truncation
"data.os_version" VARCHAR(32) ENCODE LZO,
"data.pc_architecture" VARCHAR(7) ENCODE LZO,
"data.pc_battery" VARCHAR(7) ENCODE LZO,
"data.pc_category" VARCHAR(64) ENCODE LZO,
"data.pc_manufacturer" VARCHAR(64) ENCODE LZO, -- Expect truncation
"data.pc_modelname" VARCHAR(64) ENCODE LZO, -- Expect truncation
"data.pc_sku" VARCHAR(64) ENCODE LZO, -- Expect truncation
"data.pc_touchenabled" VARCHAR(7) ENCODE LZO
)
INTERLEAVED SORTKEY ("service.server_timestamp", "app", "data.sys_uuid", "data.app_session_uuid");
|
I saw some odd formatting when I began using the new version.
I would expect all the ENCODE LZO to be on the same line as the definition. But in some of the definitions it works, but in others it does not.
formatted_create_table_sys_info_base.sql.txt
unformatted_create_table_sys_info_base.sql.txt
The text was updated successfully, but these errors were encountered: