Giter Site home page Giter Site logo

rtapi's People

Contributors

darishante avatar ipm79 avatar pixitha avatar rvojcik avatar youduda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rtapi's Issues

Locations and Rows

Hi,

I really like the possibility to interact with the racktables database from Python.
However, I'm currently missing Location, Row and Rack data which are vital for the project I'm working on.

Would it be possible for you to add those?

Hope to hear from you,

Raymond

can't import rtapi

So I've installed racktables-api as shown:

lucas@lucas:~$ pip3 show racktables-api
Name: racktables-api
Version: 0.2.8
Summary: Simple racktables API
Home-page: https://github.com/rvojcik/rtapi
Author: Robert Vojcik
Author-email: [email protected]
License: GPLv2
Location: /usr/local/lib/python3.5/dist-packages
Requires: 
Required-by:

However, cannot import it ...

lucas@lucas:~$ ipython3
Python 3.5.2 (default, Apr 16 2020, 17:47:17) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import rtapi
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-7c84d904841c> in <module>
----> 1 import rtapi

ImportError: No module named 'rtapi'

any hint? thanks!

Typo in InsertOrUpdateAttribute

There is type here causing this error:

_mysql_exceptions.ProgrammingError: (1146, "Table 'racktables.object' doesn't exist")

'object' should be capitalized -> 'Object' in the SQL query

 def InsertOrUpdateAttribute(self, object_id, attr_id, new_value):
        # Get the object type
        sql = "SELECT objtype_id FROM object WHERE id = %d" % (object_id)
result = self.db_query_one(sql)

GetObjectAttributes()

Hi!

I've seen there is a method called rt.GetObjectTags(id) which provides all of the tags assigned to a given object.

How difficult is it to implement the same but for the Attributes? The idea is to have a method that will list all of the attributes assigned to an object.

I have on my own some SQL queries that do the job. If interested, I can provide those ...

thanks!

InsertAttribute - cannot overwrite if accidentally put in data in wrong type

If you accidentally try to put string data to uint attribute (or vice-versa) through InsertAttribute (new attribute, not existing one), it will happily pass it, put it in the DB, but you won't see it in the GUI so you can't remove it without touching the DB manually.
An attempt to rewrite it with the other type will fail, because it tries to detect based on the DB contents, so it will put it in the same wrong type. It needs some handling based on None in one of the two fields.

Get Objects with given tag

Hi!

Today I have some SQL queries that I use on my own to obtain one or all the objetcs that have such a tag. Do you think it is feasible to implement it in the library? I can provide those queries if interested...

I've been seraching for the methods and I've found only rt.GetObjectTags(id). This would be the other way around: given a tag obtain the list of object_id.

thanks!

example code not working - shows error on print rt.ListObjects()

I tried the example code on the readme and I can't get it to work. Environment is:
Python 3.5.2
rtapi was installed via pip3

My file contains (credentials scrubbed):

import MySQLdb
import rtapi

# Create connection to database
try:
# Create connection to database
   db = MySQLdb.connect(host='rthost',port=3306, passwd='passwd',db='racktables',user='rtuser')
except MySQLdb.Error:
   e = sys.exc_info()[1]
   print("Error %d: %s" % (e.args[0],e.args[1]))
   sys.exit(1)

# Initialize rtapi with database connection
   rt = rtapi.RTObject(db)

# List all objects from database

   print rt.ListObjects()

The error I get is:

python3 ./sqltest.py 
  File "./sqltest.py", line 18
    print rt.ListObjects()
           ^
SyntaxError: invalid syntax

I could really use some help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.