Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8987737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:51:48+00:00 2026-06-15T21:51:48+00:00

I’m creating a schema for my DB using PostgreSQL and SQLAlchemy in declarative base

  • 0

I’m creating a schema for my DB using PostgreSQL and SQLAlchemy in declarative base and ran into a question that I think is answered but I’m somehow getting the syntax wrong.

I’m thinking of having an entry that’s a multidimensional array (I only need 2D, but I figured I’d ask for an n-dimentional array solution in case I run into other issues). I essentially need to have some_field[string][string] but am not sure of how to do that.

class SomeTable(Base):
    __tablename__ = 'some_table'
   multi_d_array = Column(postgresql.ARRAY(String)) #How do I make 2D+?

With an earlier version dimensionality was apparently unenforced (link: PostgreSQL multidimensional arrays in SQLAlchemy), but apparently this was patched (link: https://groups.google.com/forum/?fromgroups=#!topic/sqlalchemy/w4-nbMdxxUg). The documentation still says it’s unenforced (link: http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html) but I just wanted to make sure the code works alright before having my DB blow up.

Thanks for helping me with my newbie question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:51:49+00:00Added an answer on June 15, 2026 at 9:51 pm

    Postgresql itself does not enforce the dimensionality of the array – all arrays are N-dimensional even if you specify it with a specific number of dimensions. From the linked email:

    http://www.postgresql.org/docs/9.1/static/arrays.html

    “The current implementation does not enforce the declared number of dimensions either. Arrays of a particular element type are all considered to be of the same type, regardless of size or number of dimensions. So, declaring the array size or number of dimensions in CREATE TABLE is simply documentation; it does not affect run-time behavior.”

    In SQLAlchemy 0.8, the ARRAY type now includes an optional parameter “dimension=N” whereby you can give it the specific number of dimensions, which will allow the SQLAlchemy type to process incoming array data more quickly in Python (it doesn’t need to guess the number of dimensions), and also cause it to emit DDL (i.e. CREATE TABLE) with that number of dimensions specifically, but without this parameter everything would still work as is. The email you refer to is a user who wanted it to specifically say “INTEGER [][]” with that exact number of dimensions when emitting DDL, but it’s really not necessary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.