O'Reilly Forums: Rdbms To Hbase Schema Design - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Rdbms To Hbase Schema Design

#1 User is offline   rashmi_21120 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 28-June 12

Posted 28 June 2012 - 11:03 AM

Hi,

I want to change my RDBMS to HBASE schema, to be used with Hadoop platform.

I have changed two RDBMS tables into HBASE tables. I have ignored constraints, indexes and foreign key relationship. Because I dont know how to convert these relationships in Hbase schema.

Please confirm if the change I have made is correct?

Relational Schema of tables are:
==========================

TABLE : ASSTES
------------------------------------------------------------------

CREATE TABLE [dbo].[Assets](
[AssetId] [int] NOT NULL,
[AssetName] [varchar](50) NOT NULL,
CONSTRAINT [PK_Assets] PRIMARY KEY CLUSTERED
(
[AssetId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
-------------------------------------------------------------------------------------------------------------------------------


--------------------------------
TABLE: Instruments
----------------------------------
CREATE TABLE [dbo].[Instruments](
[InstrumentId] [int] IDENTITY(1,1) NOT NULL,
[AssetId] [int] NOT NULL,
[Symbol] [varchar](50) NOT NULL,
[Name] [varchar](250) NOT NULL,
[Created] [datetime] NOT NULL,
[Modified] [datetime] NULL,
[Comments] [varchar](250) NULL,
CONSTRAINT [PK_Instruments_InstrumentId] PRIMARY KEY CLUSTERED
(
[InstrumentId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [PK_Instruments_InstrumentIdAssetId] UNIQUE NONCLUSTERED
(
[InstrumentId] ASC,
[AssetId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING ON
GO

ALTER TABLE [dbo].[Instruments] WITH CHECK ADD CONSTRAINT [FK_Instruments_Assets] FOREIGN KEY([AssetId])
REFERENCES [dbo].[Assets] ([AssetId])
ON UPDATE CASCADE
GO

ALTER TABLE [dbo].[Instruments] CHECK CONSTRAINT [FK_Instruments_Assets]
GO

ALTER TABLE [dbo].[Instruments] ADD CONSTRAINT [DF_Instruments_Created_1] DEFAULT (getdate()) FOR [Created]
GO

====================================





HBASE CONVERSION OF ASSTES AND INSTRUMENTS tables:
====================================================================

Assets table
===============
RowKey -- AssetID
ColumnFamilies (AssetName ) ---- ColumnName - (Name)



Instruments table
==============
RowKey - InstrumentID
ColumnFamilies - (Content) --- Columns: Symbol, Name, Created, Modified, Comments
(Assets) --- Columns: AssetID


Please confirm if given conversion is proper?

Also, how do i convert constraints and indexes and foreign key relationship?




Thanks in advance

Regards,
rashmi
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users