Skip to main content

Convenient tool"),

Project description

pypi: https://pypi.python.org/pypi/campbel/0.0.7

便利モジュールです。

セットアップ
pip install campbel

チュートリアル
dbに接続しよう

from campbel.AWS import Rds as rds
rds = rds.Rds(
db_host = 'DBホスト',
db_user = 'DBユーザー',
db_password = 'DBパスワード',
db_name = 'DB名',
charset = 'utf-8',
)

これで接続完了!

インサートしよう
rds.insertExecute('user','name,age,message','"campbel",20,"hello"')
rds.dbClosed()
これは
INSERT INTO user (name,age,message) VALUES ("campbel",20,"hello")
と等価です。rds.dbClosed()はDBと接続を切ります。

次はデータをまとめて挿入してみましょう。辞書形式を配列にしましょう。 <-こっちを使うことを推奨します。
data_list_array = [
{'name':'ryu', age:27, 'massage':'こんにちは'},
{'name':'koumei', age:26, 'massage':'game'},
{'name':'hyuga', age:21, 'massage':'meshi'},
{'name':'kenjo', age:20, 'massage':'study'},
]
rds.insertListExecute('user', data_list_array)
rds.dbClosed()

これは
INSERT INTO user (name,age,message) VALUES ("ryu",27,"こんにちは")
INSERT INTO user (name,age,message) VALUES ("koumei",26,"game")
INSERT INTO user (name,age,message) VALUES ("hyuga",21,"meshi")
INSERT INTO user (name,age,message) VALUES ("kenjo",20,"study")
と等価です。

次はs3に接続してみよう!

from campbel.AWS import S3 as s3

s3 = spython setup.py register3.S3(
access_key = 'アクセスキー',
secret_access_key = 'シークレットアクセスキー',
bucket_name = 'バケット名',
)

これで接続完了です。

S3の/test/とディレクトリを作ろう。
s3.createDir('test/')

ローカルのa.txtをデータを入れよう!
s3.uploadFileToS3(a.txt, 'test/a.txt')



















<!-- -->


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

campbel-0.0.17.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

campbel-0.0.17-py2-none-any.whl (8.5 kB view details)

Uploaded Python 2

File details

Details for the file campbel-0.0.17.tar.gz.

File metadata

  • Download URL: campbel-0.0.17.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for campbel-0.0.17.tar.gz
Algorithm Hash digest
SHA256 e72a24ebcba42b61446738a49c1fe022084dc74e6f6faa82d90c256f070280a2
MD5 60c79ab4e8fbae616c262211d188d178
BLAKE2b-256 837039788b46f0bb6827a0c02ea3f9fb5820fdac920b7d7330f75331382d67ed

See more details on using hashes here.

File details

Details for the file campbel-0.0.17-py2-none-any.whl.

File metadata

File hashes

Hashes for campbel-0.0.17-py2-none-any.whl
Algorithm Hash digest
SHA256 1470c3025df3018a7544abf9cab75ed4902e4f7a3445e061b188ea4242649a37
MD5 58795cc4e95d6139776752a759705d45
BLAKE2b-256 8efd677408466df7c949621cd67bec733a024de95951e244947c6fcd263ab810

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page