dbcli / litecli

CLI for SQLite Databases with auto-completion and syntax highlighting
https://litecli.com
BSD 3-Clause "New" or "Revised" License
2.12k stars 68 forks source link

Describe table does not work #64

Closed pydemo closed 4 years ago

pydemo commented 5 years ago

tried for table ME_13F:

.schema [ME_13F] Result:

Time: 0.001s

\dt ME_13F Result:

Time: 0.001s

describe table ME_13F Result:

Time: 0.001s

desc ME_13F Result:

+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | sql | +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | CREATE TABLE ME_13F ("BusinessUnit" varchar,"Advisor" varchar,"Issuer_13F" varchar,"MSymbol" varchar,"MsymbolDesc" varchar,"Description13F" varchar,"FinancialType13F" varchar,"FinancialType" varchar,"SwapType" varchar,"Cusip" varchar,"UnderlyingCusip" varchar,"Is13FSec" int,"IsDefaulted" int,"PosMarketVal" float,"PosQty" float,"ConvRatio" float,"UnderlyingKey" int,"UnderlyingSymbol" varchar,"UnderlyingDesc" varchar,"UnderlyingPrice" float,"UnderlyingTf" float,"QtyCalcBasedonRatio" float,"MVCa... | +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Time: 0.014s

PRAGMA table_info([ME_13F])

Result:


+-----+---------------------+-----------+---------+------------+----+
| cid | name                | type      | notnull | dflt_value | pk |
+-----+---------------------+-----------+---------+------------+----+
| 0   | BusinessUnit        | varchar   | 0       | <null>     | 0  |
| 1   | Advisor             | varchar   | 0       | <null>     | 0  |
| 2   | Issuer_13F          | varchar   | 0       | <null>     | 0  |
| 3   | MSymbol             | varchar   | 0       | <null>     | 0  |
| 4   | MsymbolDesc         | varchar   | 0       | <null>     | 0  |
| 5   | Description13F      | varchar   | 0       | <null>     | 0  |
| 6   | FinancialType13F    | varchar   | 0       | <null>     | 0  |
| 7   | FinancialType       | varchar   | 0       | <null>     | 0  |
| 8   | SwapType            | varchar   | 0       | <null>     | 0  |
| 9   | Cusip               | varchar   | 0       | <null>     | 0  |
| 10  | UnderlyingCusip     | varchar   | 0       | <null>     | 0  |
| 11  | Is13FSec            | int       | 0       | <null>     | 0  |
| 12  | IsDefaulted         | int       | 0       | <null>     | 0  |
| 13  | PosMarketVal        | float     | 0       | <null>     | 0  |
| 14  | PosQty              | float     | 0       | <null>     | 0  |
| 15  | ConvRatio           | float     | 0       | <null>     | 0  |
| 16  | UnderlyingKey       | int       | 0       | <null>     | 0  |
| 17  | UnderlyingSymbol    | varchar   | 0       | <null>     | 0  |
| 18  | UnderlyingDesc      | varchar   | 0       | <null>     | 0  |
| 19  | UnderlyingPrice     | float     | 0       | <null>     | 0  |
| 20  | UnderlyingTf        | float     | 0       | <null>     | 0  |
| 21  | QtyCalcBasedonRatio | float     | 0       | <null>     | 0  |
| 22  | MVCalcBasedonRatio  | float     | 0       | <null>     | 0  |
| 23  | PosTf               | float     | 0       | <null>     | 0  |
| 24  | FaceQty             | float     | 0       | <null>     | 0  |
| 25  | FaceCurrentQty      | float     | 0       | <null>     | 0  |
| 26  | Qty_13F             | float     | 0       | <null>     | 0  |
| 27  | MV_13F              | float     | 0       | <null>     | 0  |
| 28  | Is13FReportable     | int       | 0       | <null>     | 0  |
| 29  | LongShortInd        | varchar   | 0       | <null>     | 0  |
| 30  | InstrumentID        | int       | 0       | <null>     | 0  |
| 31  | BusinessUnitId      | int       | 0       | <null>     | 0  |
| 32  | FinancialTypeCode   | int       | 0       | <null>     | 0  |
| 33  | AccountingDate      | date      | 0       | <null>     | 0  |
| 34  | AsOfDateTime        | timestamp | 0       | <null>     | 0  |
+-----+---------------------+-----------+---------+------------+----+
35 rows in set
amjith commented 5 years ago

That's odd. You're saying that desc ME_13F works but .schema ME_13F doesn't work?

pydemo commented 5 years ago

yes, only PRAGMA table_info([ME_13F]) works as expected. i do not need table DDL when i do desc, i need column list

amjith commented 5 years ago

Good point. I'll change desc and describe to show what pragma does.

zzl0 commented 4 years ago

Amjith has fixed this in https://github.com/dbcli/litecli/pull/67, please update your litecli to the latest version.

jbulow commented 4 years ago

This is still an issue in version 1.2:

litecli Configuration/configuration.db
Version: 1.2.0
Mail: https://groups.google.com/forum/#!forum/litecli-users
GitHub: https://github.com/dbcli/litecli
Configuration/configuration.db> .schema `SemanticIRI`
Time: 0.001s
Configuration/configuration.db>                                                       

Compared to vanilla sqlite:

sqlite3 Configuration/configuration.db
SQLite version 3.28.0 2019-04-16 19:49:53
Enter ".help" for usage hints.
sqlite> .schema SemanticIRI
CREATE TABLE SemanticIRI (Id INTEGER PRIMARY KEY, IRI TEXT UNIQUE, ObjectInstanceId INTEGER);
CREATE UNIQUE INDEX SemanticIRIIndex ON SemanticIRI(IRI);