Create DynamoDB Table – AWS CLI

Hi everyone,

A quick example of how to create a dynamodb table using the AWS CLI:

aws dynamodb create-table --table-name CatBreeds --attribute-definitions AttributeName=CatBreedId,AttributeType=S --key-schema AttributeName=CatBreedId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5

For more info the following AWS page helped me: https://docs.aws.amazon.com/cli/latest/reference/dynamodb/create-table.html

undefined method `to_sym’ for nil:NilClass – Ruby on Rails Migration

While trying to do a migration today I received the following message:

undefined method `to_sym’ for nil:NilClass

#After running a trace (rake db:migrate –trace)
undefined method `to_sym’ for nil:NilClass
/usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/whiny_nil.rb:48:in `method_missing’

This was the migration:

class AddDefaultValuesToFeedbacks  0
    change_column :stores, :rating, :decimal, :precision => 8, :scale => 2, :default => 0
  end
end

Unfortunately this problem also prevented me from performing any other migrations on the table. I attempted deleting all relevant migration files and then re-running them, restarting the server and rolling back to a previous migration – none of which worked.

Eventually I resorted to exporting the dataset, dropping the table via sqlite3 and recreating it. Thankfully this seems to have worked. The only hint I’ve come across that may explain the cause of this problem, other than typos or referring to non-existant columns, is that it can occur if a migration is screwed over before it finishes and fails to rollback properly.

If anyone else has any concrete answers, please let me know in the comments!

How to Edit a Message Catalog Definition – PeopleSoft

Editing a message catalog definition in PeopleSoft is pretty straight forward, simply browse to the following menu path:

PeopleTools > Utilities > Administration > Message Catalog

Enter your message set number into the prompt. Note that if you do not know your message set number you can use the following to find it:

SELECT *
FROM PSMSGCATDEFN
WHERE MESSAGE_SET_NBR = '12345'
      AND MESSAGE_NBR = '12345';
      
SELECT *
FROM PSMSGCATDEFN
WHERE MESSAGE_TEXT LIKE '%what your message is%';

Once you have your message simply edit the text and description appropriately then save!

How to View a Table’s Structure – Sqlite3

Just a quick post on how to view a table’s structure in SQLite3. Again, not something I’ve broken yet – more something I seem to keep forgetting. Simply start Sqlite:
chris@chris-VirtualBox:~/site$ sqlite3 -line db/development.sqlite3
SQLite version 3.7.4
Enter “.help” for instructions
Enter SQL statements terminated with a “;”

Then enter the following: – substituting orders for whatever your table name happens to be:
sqlite> pragma table_info(orders);
cid = 0
name = id
type = INTEGER
notnull = 1
dflt_value =
pk = 1

cid = 1
name = user_id
type = integer
notnull = 0
dflt_value =
pk = 0

cid = 3
name = created_at
type = datetime
notnull = 0
dflt_value =
pk = 0

Good Luck!

View All Tables – Sqlite3

Not really something that I’ve broken (yet), but definitely something I found useful when starting out with rails – how to view all tables:

Start Sqlite3 i.e.
chris@chris-VirtualBox:~/site$ sqlite3 -line db/development.sqlite3
SQLite version 3.7.4
Enter “.help” for instructions
Enter SQL statements terminated with a “;”

Then simply enter the following:
sqlite> .tables
carts message_recipients products taggings
categories message_statuses schema_migrations tags
comments messages store_pages user_settings
images order_items store_settings users
line_items orders stores
locations product_images sub_orders
sqlite>

Good Luck!