DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Top Six React Development Tools
  • Using OpenAI Embeddings Search With SingleStoreDB
  • Database Integration Tests With Spring Boot and Testcontainers
  • Send Email Using Spring Boot (SMTP Integration)

Trending

  • Top Six React Development Tools
  • Using OpenAI Embeddings Search With SingleStoreDB
  • Database Integration Tests With Spring Boot and Testcontainers
  • Send Email Using Spring Boot (SMTP Integration)
  1. DZone
  2. Data Engineering
  3. Databases
  4. NuoSQL Options for Displaying Data

NuoSQL Options for Displaying Data

Seth  Proctor user avatar by
Seth Proctor
·
Sep. 21, 13 · Interview
Like (0)
Save
Tweet
Share
2.68K Views

Join the DZone community and get the full member experience.

Join For Free

The NuoSQL tool, nuosql, is the command line utility for accessing data in NuoDB.  There is one new option as of NuoDB 1.2 that is very useful for displaying data with very wide columns using nuosql.  Then there's another new option (but you'll have to wait for NuoDB 2.0) that is useful for displaying many rows of data.

Displaying your data is a challenge when you have very long character strings in a column or new lines in a character string column.  To demonstrate this, I created a table with the following schema:

SQL> show table nuodb_friends

    Found table NUODB_FRIENDS in schema USER

        NAME string
        HOME_ADDRESS string
        WHAT_THEY_DO_AT_NUODB string
        WHY_THEY_ARE_MY_FRIEND string

SQL> 

The data in the HOME_ADDRESS column has newlines and data in the other columns might be particularly long.    Simply doing a SELECT in nuosql presents some pretty messy, unreadable output.

SQL> select * from nuodb_friends;

   NAME                HOME_ADDRESS                                    WHAT_THEY_DO_AT_NUODB                                                                                               WHY_THEY_ARE_MY_FRIEND                                                                        
 --------- ------------------------------------ ------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 Paul      10 Main St.
Sunnytown, MA
01010
USA  Product Management which pretty much means everything, Makes coffee He tells funny stories about his family and kids.  He is always available to listen to my stories about life with my teenage children.                               
 John      11 Elm St.
Sunnyville, NH
02020      SQL engine, wicked smaaahht, knows a lot about Hibernate and Java   This is the third company we have worked at together.  He is very, very nice and I can ask him all my stupid questions.  And he has an enjoyable level of pessimism. 
 Elisabete 100 LongCommute St.
Springfield, USA Customer support, generally friendly and helpful resource           She is super friendly and always smiling.                                                                                                                            

SQL> 

Yuck!   Sometimes it's just easier to display the data vertically instead of horizontally, so nuosql lets you do this.  All you have to do is say "SET OUTPUT VERTICAL".

SQL> set output vertical;
SQL> select * from nuodb_friends;
==================================== Row #1 ====================================
NAME: Paul
HOME_ADDRESS: 10 Main St.
Sunnytown, MA
01010
USA
WHAT_THEY_DO_AT_NUODB: Product Management which pretty much means everything, Makes coffee
WHY_THEY_ARE_MY_FRIEND: He tells funny stories about his family and kids.  He is always available to listen to my stories about life with my teenage children.
==================================== Row #2 ====================================
NAME: John
HOME_ADDRESS: 11 Elm St.
Sunnyville, NH
02020
WHAT_THEY_DO_AT_NUODB: SQL engine, wicked smaaahht, knows a lot about Hibernate and Java
WHY_THEY_ARE_MY_FRIEND: This is the third company we have worked at together.  He is very, very nice and I can ask him all my stupid questions.  And he has an enjoyable level of pessimism.
==================================== Row #3 ====================================
NAME: Elisabete
HOME_ADDRESS: 100 LongCommute St.
Springfield, USA
WHAT_THEY_DO_AT_NUODB: Customer support, generally friendly and helpful resource
WHY_THEY_ARE_MY_FRIEND: She is super friendly and always smiling.

SQL> 

Pretty cool, right?  

Spoiler alert... Now suppose you have rows and rows and rows of data and when you do your SELECT it streams by in a flash.  Well you can always scroll back.  Or, with NuoDB 2.0, you will be able to set a PAGER.  Setting a PAGER will cause the results of your SQL query to be piped to that command.  You can specify a one word pager, for example,

SQL> SET PAGER more;

which will set the pager to the specified command and the command must be on the user's PATH.  Or you can specify a full command string surrounded in quotes, for example,

SQL> SET PAGER "less -X -E"

A colleague asked if you could set the pager to anything, like an editor or something.  Yep, you can really hang yourself with this, but you can also do a lot of useful things.   Check this out:

SQL> create table names(who string);
SQL> insert into names values('Mary'), ('Abe'), ('John'), ('Zeb'), ('Laurie'), ('Oleg'), ('Zoey'), ('Jakob');
SQL> select * from names;

  WHO   
 ------ 

 Mary   
 Abe    
 John   
 Zeb    
 Laurie 
 Oleg   
 Zoey   
 Jakob  

SQL> set pager sort;
SQL> select * from names;


  WHO   
 ------ 
 Abe    
 Jakob  
 John   
 Laurie 
 Mary   
 Oleg   
 Zeb    
 Zoey   
SQL> 

It's really fun to add useful features and make this tool more user-friendly.  I'm curious what useful options you would like to see implemented in nuosql.   Respond in comments here!

Data (computing) sql Database

Published at DZone with permission of Seth Proctor, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Top Six React Development Tools
  • Using OpenAI Embeddings Search With SingleStoreDB
  • Database Integration Tests With Spring Boot and Testcontainers
  • Send Email Using Spring Boot (SMTP Integration)

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: