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

Legacy schema #383

Open
dsisnero opened this issue Sep 3, 2020 · 0 comments
Open

Legacy schema #383

dsisnero opened this issue Sep 3, 2020 · 0 comments
Labels

Comments

@dsisnero
Copy link

dsisnero commented Sep 3, 2020

module Edr

module Relations

class Facilities < ROM::Relation[:sql]
  schema(:FSEP_DAILY, as: :facilities, infer: true) do
    attribute :factyp_cd, Types::String.meta(alias: :factype)
    attribute :locid_cd, Types::String.meta(alias: :locid)
    attribute :cc_cd, Types::String.meta(alias: :cost_code)
 end

end

end

when I use either the facilities relation or the facility_rep I expect to get back a struct with my attributes mapped to alias but I don't.

42] pry(main)> fac_repo.query(cc_cd: btf_rtr.cc_cd)
=> #<Edr::Relations::Facilities name=ROM::Relation::Name(facilities on FSEP_DAILY) dataset=#<Sequel::Oracle::Dataset: "SELECT "FSEP_DAILY"."FACTYP_CD", "FSEP_DAILY"."LOCID_CD", "FSEP_DAILY"."CC_CD", "FSEP_DAILY"."RGN_CD", "FSEP_DAILY"."FACCLAS_CD", "FSEP_DAILY"."SYSTYP_CD", "FSEP_DAILY"."FAC_CD", "FSEP_DAILY"."FIC_CD", "FSEP_DAILY"."FAC_STAT_CD", "FSEP_DAILY"."GSAADDR_CD", "FSEP_DAILY"."INVLOC_CD", "FSEP_DAILY"."OWNR_RSPNSB_CD", "FSEP_DAILY"."FAC_STAT_DT", "FSEP_DAILY"."RSPN_CD", "FSEP_DAILY"."LOC_NAME", "FSEP_DAILY"."ST_ABBRV", "FSEP_DAILY"."RUNWAY_ID", "FSEP_DAILY"."REMOTE_LOCID_CD", "FSEP_DAILY"."CONTROL_LOCID_CD", "FSEP_DAILY"."AIRPORT_LOCID_CD", "FSEP_DAILY"."PWR_CD", "FSEP_DAILY"."FACILITY_CNT", "FSEP_DAILY"."SWAP_DT", "FSEP_DAILY"."FAC_FREQ_CNT", "FSEP_DAILY"."CTR_MAINT_PCT", "FSEP_DAILY"."ENV_PRIM_FACTYP_CD", "FSEP_DAILY"."ENV_ANNUAL_TRIP_CNT", "FSEP_DAILY"."ENV_PRIM_LOCID_CD", "FSEP_DAILY"."ENV_TRVL_ONEWAY_MN", "FSEP_DAILY"."ELT_PRIM_FACTYP_CD", "FSEP_DAILY"."ELT_ANNUAL_TRIP_CNT", "FSEP_DAILY"."ELT_PRIM_LOCID_CD", "FSEP_DAILY"."ELT_TRVL_ONEWAY_MN", "FSEP_DAILY"."CONGRESS_CD", "FSEP_DAILY"."MONITOR_LOCID_CD", "FSEP_DAILY"."FSEP_MODIFIED_DT", "FSEP_DAILY"."NDC_CREATED_DT", "FSEP_DAILY"."RUNWAY2_ID", "FSEP_DAILY"."MOD_CNT", "FSEP_DAILY"."SDP_CD", "FSEP_DAILY"."SDP_TYP", "FSEP_DAILY"."ATOW_ORG", "FSEP_DAILY"."BLDG_LOCID_CD", "FSEP_DAILY"."BLDG_TYP", "FSEP_DAILY"."YR_BUILT", "FSEP_DAILY"."PRECOMM_DT", "FSEP_DAILY"."COMM_DT", "FSEP_DAILY"."DECOMM_DT", "FSEP_DAILY"."ELEVATION", "FSEP_DAILY"."LATITUDE", "FSEP_DAILY"."LONGITUDE", "FSEP_DAILY"."MANNED_FLAG", "FSEP_DAILY"."ANNUAL_TRIP_CNT", "FSEP_DAILY"."TRVL_ONEWAY_MN", "FSEP_DAILY"."PRIM_FACTYP_CD", "FSEP_DAILY"."PRIM_LOCID_CD" FROM "FSEP_DAILY" WHERE ("CC_CD" = '82EH0000')">>
[43] pry(main)> fac_repo.query(cc_cd: btf_rtr.cc_cd).first
=> #<Edr::Facility factyp_cd="VOR" locid_cd="YAK" cc_cd="82EH0000" rgn_cd="AL" facclas_cd="A" systyp_cd="1" fac_cd="11AE" fic_cd="111AE" fac_stat_cd="D" gsaaddr_cd="0158" invloc_cd="D1" ownr_rspnsb_cd="A" fac_stat_dt=1959-02-01 00:00:00 -0600 rspn_cd="24" loc_name="YAKUTAT" st_abbrv="AK" runway_id=nil remote_locid_cd="YAK" control_locid_cd="ZAN" airport_locid_cd=nil pwr_cd="A" facility_cnt=1 swap_dt=1983-06-01 00:00:00 -0600 fac_freq_cnt=0 ctr_maint_pct=0 env_prim_factyp_cd=nil env_annual_trip_cnt=nil env_prim_locid_cd=nil env_trvl_oneway_mn=nil elt_prim_factyp_cd=nil elt_annual_trip_cnt=nil elt_prim_locid_cd=nil elt_trvl_oneway_mn=nil congress_cd=nil monitor_locid_cd="ZAN" fsep_modified_dt=2018-02-16 17:31:52 -0600 ndc_created_dt=2020-09-03 01:25:19 -0600 runway2_id=nil mod_cnt=2 sdp_cd="ZAN" sdp_typ="ARTCC" atow_org="WWQ36" bldg_locid_cd="YAK" bldg_typ="NASEB" yr_built=nil precomm_dt=nil comm_dt=1959-02-01 00:00:00 -0600 decomm_dt=nil elevation=0 latitude=59.510831 longitude=-139.64812 manned_flag=nil annual_trip_cnt=16 trvl_oneway_mn=180 prim_factyp_cd="VOR" prim_locid_cd="YAK">
[44] pry(main)>

fac

Oracle Database
Windows
f:>ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]

@dsisnero dsisnero added the bug label Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant