Hi Gaetan, Thanks for the quick reply.
Below is a sample of a Postgres script of a table converted from a legacy software, as you can see Table/Field names are a bit cryptic but the comments make sense. I am trying to make a Query Builder where users can choose tables and fields at runtime. But with cryptic Table and Field names my only option is to create an xref table, unless of course I can access the schema comments (must apply to all db supported by Elixir/SA) Thanks in Advance George CREATE TABLE a10 ( accomp character varying, -- Company Code acacct character varying, -- Account Number acyear integer, -- Year acclas character varying, -- Product Class Code acgrup character varying, -- Product Group Code acsqty_01 integer, -- Quantity 1 acsqty_02 integer, -- Quantity 2 acsqty_03 integer, -- Quantity 3 acsqty_04 integer, -- Quantity 4 acsqty_05 integer, -- Quantity 5 acsqty_06 integer, -- Quantity 6 acsqty_07 integer, -- Quantity 7 acsqty_08 integer, -- Quantity 8 acsqty_09 integer, -- Quantity 9 acsqty_10 integer, -- Quantity 10 acsqty_11 integer, -- Quantity 11 acsqty_12 integer, -- Quantity 12 acstva_01 numeric, -- Std Cost Value 1 acstva_02 numeric, -- Std Cost Value 2 acstva_03 numeric, -- Std Cost Value 3 acstva_04 numeric, -- Std Cost Value 4 acstva_05 numeric, -- Std Cost Value 5 acstva_06 numeric, -- Std Cost Value 6 acstva_07 numeric, -- Std Cost Value 7 acstva_08 numeric, -- Std Cost Value 8 acstva_09 numeric, -- Std Cost Value 9 acstva_10 numeric, -- Std Cost Value 10 acstva_11 numeric, -- Std Cost Value 11 acstva_12 numeric, -- Std Cost Value 12 acavva_01 numeric, -- Average Cost Value 1 acavva_02 numeric, -- Average Cost Value 2 acavva_03 numeric, -- Average Cost Value 3 acavva_04 numeric, -- Average Cost Value 4 acavva_05 numeric, -- Average Cost Value 5 acavva_06 numeric, -- Average Cost Value 6 acavva_07 numeric, -- Average Cost Value 7 acavva_08 numeric, -- Average Cost Value 8 acavva_09 numeric, -- Average Cost Value 9 acavva_10 numeric, -- Average Cost Value 10 acavva_11 numeric, -- Average Cost Value 11 acavva_12 numeric, -- Average Cost Value 12 aclava_01 numeric, -- Latest Cost Value 1 aclava_02 numeric, -- Latest Cost Value 2 aclava_03 numeric, -- Latest Cost Value 3 aclava_04 numeric, -- Latest Cost Value 4 aclava_05 numeric, -- Latest Cost Value 5 aclava_06 numeric, -- Latest Cost Value 6 aclava_07 numeric, -- Latest Cost Value 7 aclava_08 numeric, -- Latest Cost Value 8 aclava_09 numeric, -- Latest Cost Value 9 aclava_10 numeric, -- Latest Cost Value 10 aclava_11 numeric, -- Latest Cost Value 11 aclava_12 numeric, -- Latest Cost Value 12 acseva_01 numeric, -- Selling Price Value 1 acseva_02 numeric, -- Selling Price Value 2 acseva_03 numeric, -- Selling Price Value 3 acseva_04 numeric, -- Selling Price Value 4 acseva_05 numeric, -- Selling Price Value 5 acseva_06 numeric, -- Selling Price Value 6 acseva_07 numeric, -- Selling Price Value 7 acseva_08 numeric, -- Selling Price Value 8 acseva_09 numeric, -- Selling Price Value 9 acseva_10 numeric, -- Selling Price Value 10 acseva_11 numeric, -- Selling Price Value 11 acseva_12 numeric, -- Selling Price Value 12 acbrch character varying, -- Branch Code acbrnd character varying, -- Brand Code acdtzz date, -- Date Last Changed actmzz integer, -- Time Last Changed acopzz character varying -- OpId of Last Change ) WITH (OIDS=TRUE); ALTER TABLE a10 OWNER TO gvv; COMMENT ON TABLE a10 IS 'Customer Analysis File'; COMMENT ON COLUMN a10.accomp IS 'Company Code'; COMMENT ON COLUMN a10.acacct IS 'Account Number'; COMMENT ON COLUMN a10.acyear IS 'Year'; COMMENT ON COLUMN a10.acclas IS 'Product Class Code'; COMMENT ON COLUMN a10.acgrup IS 'Product Group Code'; COMMENT ON COLUMN a10.acsqty_01 IS 'Quantity 1'; COMMENT ON COLUMN a10.acsqty_02 IS 'Quantity 2'; COMMENT ON COLUMN a10.acsqty_03 IS 'Quantity 3'; COMMENT ON COLUMN a10.acsqty_04 IS 'Quantity 4'; COMMENT ON COLUMN a10.acsqty_05 IS 'Quantity 5'; COMMENT ON COLUMN a10.acsqty_06 IS 'Quantity 6'; COMMENT ON COLUMN a10.acsqty_07 IS 'Quantity 7'; COMMENT ON COLUMN a10.acsqty_08 IS 'Quantity 8'; COMMENT ON COLUMN a10.acsqty_09 IS 'Quantity 9'; COMMENT ON COLUMN a10.acsqty_10 IS 'Quantity 10'; COMMENT ON COLUMN a10.acsqty_11 IS 'Quantity 11'; COMMENT ON COLUMN a10.acsqty_12 IS 'Quantity 12'; COMMENT ON COLUMN a10.acstva_01 IS 'Std Cost Value 1'; COMMENT ON COLUMN a10.acstva_02 IS 'Std Cost Value 2'; COMMENT ON COLUMN a10.acstva_03 IS 'Std Cost Value 3'; COMMENT ON COLUMN a10.acstva_04 IS 'Std Cost Value 4'; COMMENT ON COLUMN a10.acstva_05 IS 'Std Cost Value 5'; COMMENT ON COLUMN a10.acstva_06 IS 'Std Cost Value 6'; COMMENT ON COLUMN a10.acstva_07 IS 'Std Cost Value 7'; COMMENT ON COLUMN a10.acstva_08 IS 'Std Cost Value 8'; COMMENT ON COLUMN a10.acstva_09 IS 'Std Cost Value 9'; COMMENT ON COLUMN a10.acstva_10 IS 'Std Cost Value 10'; COMMENT ON COLUMN a10.acstva_11 IS 'Std Cost Value 11'; COMMENT ON COLUMN a10.acstva_12 IS 'Std Cost Value 12'; COMMENT ON COLUMN a10.acavva_01 IS 'Average Cost Value 1'; COMMENT ON COLUMN a10.acavva_02 IS 'Average Cost Value 2'; COMMENT ON COLUMN a10.acavva_03 IS 'Average Cost Value 3'; COMMENT ON COLUMN a10.acavva_04 IS 'Average Cost Value 4'; COMMENT ON COLUMN a10.acavva_05 IS 'Average Cost Value 5'; COMMENT ON COLUMN a10.acavva_06 IS 'Average Cost Value 6'; COMMENT ON COLUMN a10.acavva_07 IS 'Average Cost Value 7'; COMMENT ON COLUMN a10.acavva_08 IS 'Average Cost Value 8'; COMMENT ON COLUMN a10.acavva_09 IS 'Average Cost Value 9'; COMMENT ON COLUMN a10.acavva_10 IS 'Average Cost Value 10'; COMMENT ON COLUMN a10.acavva_11 IS 'Average Cost Value 11'; COMMENT ON COLUMN a10.acavva_12 IS 'Average Cost Value 12'; COMMENT ON COLUMN a10.aclava_01 IS 'Latest Cost Value 1'; COMMENT ON COLUMN a10.aclava_02 IS 'Latest Cost Value 2'; COMMENT ON COLUMN a10.aclava_03 IS 'Latest Cost Value 3'; COMMENT ON COLUMN a10.aclava_04 IS 'Latest Cost Value 4'; COMMENT ON COLUMN a10.aclava_05 IS 'Latest Cost Value 5'; COMMENT ON COLUMN a10.aclava_06 IS 'Latest Cost Value 6'; COMMENT ON COLUMN a10.aclava_07 IS 'Latest Cost Value 7'; COMMENT ON COLUMN a10.aclava_08 IS 'Latest Cost Value 8'; COMMENT ON COLUMN a10.aclava_09 IS 'Latest Cost Value 9'; COMMENT ON COLUMN a10.aclava_10 IS 'Latest Cost Value 10'; COMMENT ON COLUMN a10.aclava_11 IS 'Latest Cost Value 11'; COMMENT ON COLUMN a10.aclava_12 IS 'Latest Cost Value 12'; COMMENT ON COLUMN a10.acseva_01 IS 'Selling Price Value 1'; COMMENT ON COLUMN a10.acseva_02 IS 'Selling Price Value 2'; COMMENT ON COLUMN a10.acseva_03 IS 'Selling Price Value 3'; COMMENT ON COLUMN a10.acseva_04 IS 'Selling Price Value 4'; COMMENT ON COLUMN a10.acseva_05 IS 'Selling Price Value 5'; COMMENT ON COLUMN a10.acseva_06 IS 'Selling Price Value 6'; COMMENT ON COLUMN a10.acseva_07 IS 'Selling Price Value 7'; COMMENT ON COLUMN a10.acseva_08 IS 'Selling Price Value 8'; COMMENT ON COLUMN a10.acseva_09 IS 'Selling Price Value 9'; COMMENT ON COLUMN a10.acseva_10 IS 'Selling Price Value 10'; COMMENT ON COLUMN a10.acseva_11 IS 'Selling Price Value 11'; COMMENT ON COLUMN a10.acseva_12 IS 'Selling Price Value 12'; COMMENT ON COLUMN a10.acbrch IS 'Branch Code'; COMMENT ON COLUMN a10.acbrnd IS 'Brand Code'; COMMENT ON COLUMN a10.acdtzz IS 'Date Last Changed'; COMMENT ON COLUMN a10.actmzz IS 'Time Last Changed'; COMMENT ON COLUMN a10.acopzz IS 'OpId of Last Change'; On Jan 16, 7:41 pm, "Gaetan de Menten" <[email protected]> wrote: > On Thu, Jan 15, 2009 at 14:27, gvv <[email protected]> wrote: > > How can I get Field Attributes ? > > > ie. > > class User(Entity): > > Name = Field(String(30)) > > > I need to know the max_length of User.Name and > > User.table.columns['Name'].type.length > > > if from legacy database it's column label (from the database column > > comments) > > I don't understand what you mean here. Could you provide an example? > > -- > Gaëtan de Mentenhttp://openhex.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SQLElixir" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlelixir?hl=en -~----------~----~----~----~------~----~------~--~---
